Merge lp://qastaging/~coalwater/lernid/fix-925702 into lp://qastaging/lernid

Proposed by Mohammad AbuShady
Status: Merged
Merged at revision: 231
Proposed branch: lp://qastaging/~coalwater/lernid/fix-925702
Merge into: lp://qastaging/lernid
Diff against target: 32 lines (+11/-10)
1 file modified
lernid/widgets/IrcWidget.py (+11/-10)
To merge this branch: bzr merge lp://qastaging/~coalwater/lernid/fix-925702
Reviewer Review Type Date Requested Status
John S. Gruber Approve
Review via email: mp+91364@code.qastaging.launchpad.net

Description of the change

After fixing the bug i also found another bug about the unicode conversion, that's why i added the type test before conversion

To post a comment you must log in.
Revision history for this message
Mohammad AbuShady (coalwater) wrote :

When i think about it i'm not sure if these changes broke the other checks or not

                if self._nick in text and sender != self._nick:
                    self._buffer.insert_with_tags_by_name(iend, text, 'highlight')
                elif self._on_faculty(sender):
                    self._buffer.insert_with_tags_by_name(iend, text, 'highlight')
                elif sender.lower() in self._classbotnames:
                    self._buffer.insert_with_tags_by_name(iend, text, 'italicize')

i think i should test them first

Revision history for this message
John S. Gruber (jsjgruber) wrote :

Yes, please. Testing those would be a good idea.

Can you tell me about the unicode conversion problem you found? Is it worth a bug report?

Revision history for this message
Mohammad AbuShady (coalwater) wrote :

This is the old line of the url matching
for url in re.finditer(r"https?://\S+", unicode(text, 'utf-8')):

in the NativeClassroom.py line 181
http://bazaar.launchpad.net/~lernid-devs/lernid/trunk/view/head:/lernid/widgets/NativeChatroom.py#L181
self._append_to_buffer(_('IRC commands are not yet supported.'))
for some reason lernid sees this text as unicode and when trying to apply the unicode part [unicode(text,'utf-8')] it throws an error, you can easily simulate this error in python console by doing this
  >>> unicode(u'aaa','utf-8')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: decoding Unicode is not supported

when i added a test in the file before the unicode, [print type(text)] it always returned str but in this single case ( the irc command exception message ) it returned type unicode so i simple added the type check to avoid this.

Revision history for this message
John S. Gruber (jsjgruber) wrote :

Looks good to me. Thanks again.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches