Merge lp:~felipekellermann-deactivatedaccount/beautifulsoup/felipek-571812 into lp:beautifulsoup/3.0

Proposed by Felipe Kellermann
Status: Rejected
Rejected by: Leonard Richardson
Proposed branch: lp:~felipekellermann-deactivatedaccount/beautifulsoup/felipek-571812
Merge into: lp:beautifulsoup/3.0
Diff against target: 14 lines (+3/-1)
1 file modified
BeautifulSoup.py (+3/-1)
To merge this branch: bzr merge lp:~felipekellermann-deactivatedaccount/beautifulsoup/felipek-571812
Reviewer Review Type Date Requested Status
Leonard Richardson Pending
Review via email: mp+24447@code.launchpad.net

Commit message

Fixes bug 571812.

Description of the change

Fixes bug 571812.

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) wrote :

This looks good; I have a couple comments.

1. Bytearrays were introduced in 2.6. Can you change the branch so that the code will also work in earlier versions of Python?

2. I just ran the test suite on Python 2.6 and all the tests passed. Can you write a unit test that fails with the error you gave in bug 571812?

Revision history for this message
Leonard Richardson (leonardr) wrote :

> 2. I just ran the test suite on Python 2.6 and all the tests passed. Can you
> write a unit test that fails with the error you gave in bug 571812?

It doesn't even have to be a formal unit test; just some standalone code that fails. I can turn it into a unit test if you prefer.

Revision history for this message
Felipe Kellermann (felipekellermann-deactivatedaccount) wrote :

Hello. Grab the content of this site with urllib.open2 and try to "parse"
it:
http://www.clibrbs.com.br - please let me know if you are unable to
reproduce it.

On Mon, May 3, 2010 at 3:55 PM, Leonard Richardson <
<email address hidden>> wrote:

> > 2. I just ran the test suite on Python 2.6 and all the tests passed. Can
> you
> > write a unit test that fails with the error you gave in bug 571812?
>
> It doesn't even have to be a formal unit test; just some standalone code
> that fails. I can turn it into a unit test if you prefer.
> --
>
> https://code.edge.launchpad.net/~felipekellermann/beautifulsoup/felipek-571812/+merge/24447
> You are the owner of lp:~felipekellermann/beautifulsoup/felipek-571812.
>

--
Felipe "FK" Kellermann

Revision history for this message
Felipe Kellermann (felipekellermann-deactivatedaccount) wrote :

I will change the patch and re-submit the merge request using ord(byte).
Thank you.

On Mon, May 3, 2010 at 3:54 PM, Leonard Richardson <
<email address hidden>> wrote:

> This looks good; I have a couple comments.
>
> 1. Bytearrays were introduced in 2.6. Can you change the branch so that the
> code will also work in earlier versions of Python?
>
> 2. I just ran the test suite on Python 2.6 and all the tests passed. Can
> you write a unit test that fails with the error you gave in bug 571812?
> --
>
> https://code.edge.launchpad.net/~felipekellermann/beautifulsoup/felipek-571812/+merge/24447
> You are the owner of lp:~felipekellermann/beautifulsoup/felipek-571812.
>

--
Felipe "FK" Kellermann

Revision history for this message
Leonard Richardson (leonardr) wrote :

A different branch fixed this bug.

Unmerged revisions

42. By Felipe Kellermann <email address hidden>

Fixes bug #571812.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'BeautifulSoup.py'
2--- BeautifulSoup.py 2010-04-09 19:30:08 +0000
3+++ BeautifulSoup.py 2010-04-29 18:39:16 +0000
4@@ -1784,7 +1784,9 @@
5
6 # If no luck and we have auto-detection library, try that:
7 if not u and chardet and not isinstance(self.markup, unicode):
8- u = self._convertFrom(chardet.detect(self.markup)['encoding'])
9+ bytes = bytearray(self.markup)
10+ charset = chardet.detect(bytes)['encoding']
11+ u = self._convertFrom(charset)
12
13 # As a last resort, try utf-8 and windows-1252:
14 if not u:

Subscribers

People subscribed via source and target branches

to all changes: