Edgewall Software

Opened 14 years ago

Closed 14 years ago

#413 closed defect (fixed)

QName-s comparision

Reported by: ilias@… Owned by: hodgestar
Priority: trivial Milestone: 0.6.1
Component: General Version: 0.6
Keywords: Cc:

Description

I've found a bug:

>>> from genshi.core import QName
>>> q1 = QName("{http://thechampion.ru/}current-path")
>>> q2 = QName("http://thechampion.ru}current-path")
>>> q1 == q2
False

Why?

>>> q1, q2
(QName('http://thechampion.ru/}current-path'), QName('http://thechampion.ru/}current-path'))
>>> q1.namespace == q2.namespace and q1.localname == q2.localname
True

WTF?

QName is subclass of unicode, so the comparision q1 == q2 uses unicode.cmp() or unicode.eq().

>>> unicode(q1), unicode(q2)
(u'{{http://thechampion.ru/}current-path', u'{http://thechampion.ru/}current-path')

Gotcha! q1 has unnecessary curly brace in the beginning.

The patches are applied.

Attachments (2)

core-0.6.x.py.patch (140 bytes) - added by ilias@… 14 years ago.
Ticket #413's patch for genshi/core.py in 0.6.x
core-py3k.py.patch (140 bytes) - added by ilias@… 14 years ago.
Ticket #413's patch for genshi/core.py in py3k

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by ilias@…

Ticket #413's patch for genshi/core.py in 0.6.x

Changed 14 years ago by ilias@…

Ticket #413's patch for genshi/core.py in py3k

comment:1 Changed 14 years ago by hodgestar

I add a test and committed your fix to the py3k branch in r1145. Thanks!

I'll see if someone will give me commit privileges to trunk so I can commit this fix there too.

comment:2 Changed 14 years ago by hodgestar

  • Owner changed from cmlenz to hodgestar
  • Status changed from new to assigned

comment:3 Changed 14 years ago by hodgestar

Fix committed to trunk by asmodai in r1148. Awaiting merging to 0.6.x branch.

comment:4 Changed 14 years ago by hodgestar

  • Resolution set to fixed
  • Status changed from assigned to closed

Fix committed to 0.6.x branch in r1151.

Note: See TracTickets for help on using tickets.