Modify

Opened 5 years ago

Closed 4 years ago

#5788 closed defect (duplicate)

[Patch] AttributeError of tag query for ticket

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

Description

I met a error below;

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

And its traceback;

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


and simple patch for Python2.5 and later;

--- macros.py.org       2009-09-06 09:33:18.651535230 +0900
+++ macros.py.new       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 4 years ago by rjollos

  • Summary changed from AttributeError of tag query for ticket to [Patch] AttributeError of tag query for ticket

comment:2 Changed 4 years ago by hasienda

  • Keywords unicode added
  • Resolution set to duplicate
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.