Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed code to handle potential empty string. #790

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

seanswyi
Copy link

There are certain cases where the colspan attribute is mapped to an empty string and thus causes ValueErrors when trying to cast them to integers.

For example here:

<table>
    <colgroup>
        <col style="width:25%;">
        <col style="width:25%;">
        <col style="width:25%;">
        <col style="width:25%;">
    </colgroup>
    <thead>
        <tr>
            <th rowspan="2" scope="col">Category</th>
            <th rowspan="2" scope="col">Regular Price (per person)</th>
            <th colspan="" scope="col">Online Discounted Price</th>
            <th colspan="" scope="col">On-site Discount Price</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Adult</td>
            <td>₩69,000</td>
            <td class="cPurple fBold">₩33,100</td>
            <td class="cPurple fBold">₩32,500</td>
        </tr>
        <tr>
            <td>Teenager</td>
            <td>₩61,000</td>
            <td class="cPurple fBold">₩33,100</td>
            <td class="cPurple fBold">₩32,500</td>
        </tr>
        <tr>
            <td>Child</td>
            <td>₩53,000</td>
            <td class="cPurple fBold">₩33,100</td>
            <td class="cPurple fBold">₩32,500</td>
        </tr>
    </tbody>
</table>

The extra line that I added essentially checks to make sure that the result of td.get("colspan") is not an empty string, and if it is then make it default to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant