Opened 13 years ago

Closed 12 years ago

#5788 closed defect (duplicate)

[Patch] AttributeError of tag query for ticket

Reported by: nac Owned by: Alec Thomas
Priority: normal Component: TagsPlugin
Severity: normal Keywords: unicode
Cc: Trac Release: 0.11


I met a error below;

AttributeError: 'int' object has no attribute 'encode'

And its traceback;

File "/usr/lib/python2.5/site-packages/trac/web/", line 435, in _dispatch_request
File "/usr/lib/python2.5/site-packages/trac/web/", line 205, in dispatch
  resp = chosen_handler.process_request(req)
File "build/bdist.linux-i586/egg/tractags/", line 99, in process_requestFile "build/bdist.linux-i586/egg/tractags/", line 80, in expand_macroFile "build/bdist.linux-i586/egg/tractags/", line 80, in <lambda>

and simple patch for Python2.5 and later;

---       2009-09-06 09:33:18.651535230 +0900
+++       2009-09-06 09:48:38.975754326 +0900
@@ -77,7 +77,7 @@
         ul = builder.ul(class_='taglist')
         for resource, tags in sorted(query_result,
-                                     key=lambda r: str(r[0].id.encode('utf-8'))):
+                                     key=lambda r: str(r[0].id.encode('utf-8') if isinstance(r[0].id, unicode) else r[0].id)):
             tags = sorted(tags)
             if tags:
                 rendered_tags = [

This patch works for me.

Attachments (0)

Change History (2)

comment:1 Changed 12 years ago by Ryan J Ollos

Summary: AttributeError of tag query for ticket[Patch] AttributeError of tag query for ticket

comment:2 Changed 12 years ago by Steffen Hoffmann

Keywords: unicode added
Resolution: duplicate
Status: newclosed

There has already been some suggestions before, and even different fixes to resolve this (i.e. see #5575). Anyway thank you for taking care and taking your time to test and report the issue with a possible resolution.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Alec Thomas.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.