Modify ↓
#6786 closed defect (fixed)
usage of strftime() causes a "Genshi UnicodeDecodeError"
| Reported by: | Jens Langner | Owned by: | Ryan J Ollos |
|---|---|---|---|
| Priority: | normal | Component: | TicketChangePlugin |
| Severity: | critical | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description
Similar to ticket #4820 this plugins suffers from incorrectly using strftime() which in turn causes a "Genshi UnicodeDecodeError" to appear when a ticket is changed and the Locale is not english.
The following patch fixes the issues:
===================================================================
--- ticketchange/web_ui.py (revision 7751)
+++ ticketchange/web_ui.py (working copy)
@@ -168,11 +168,11 @@
row = cursor.fetchone()
if not row:
raise ResourceNotFound("Unable to update comment on Ticket #%d at time '%s' ('%s') - existing change not found.\n" \
- % (id, time, strftime('%A, %d %b %Y %H:%M:%S', localtime(time))))
+ % (id, time, strftime('%x %X', localtime(time))))
old_author, old_comment = (row[0], row[1])
cursor.execute("UPDATE ticket_change SET newvalue=%s WHERE ticket = %s AND time = %s AND field = 'comment'", (comment, id, time))
db.commit()
self.env.log.info("Ticket #%d comment of '%s' by '%s' has been updated by '%s':\nold value: '%s'\n\nnew value: '%s'\n" \
- % (id, strftime('%A, %d %b %Y %H:%M:%S', localtime(time)), old_author, author, old_comment.replace('\r', ''), comment.replace('\r','')))
+ % (id, strftime('%x %X', localtime(time)), old_author, author, old_comment.replace('\r', ''), comment.replace('\r','')))
Attachments (0)
Change History (4)
comment:1 Changed 16 years ago by
comment:2 Changed 16 years ago by
Up to front!
File "C:\Python25\lib\site-packages\trac\web\main.py", line 450, in _dispatch_request dispatcher.dispatch(req) File "C:\Python25\lib\site-packages\trac\web\main.py", line 206, in dispatch resp = chosen_handler.process_request(req) File "build\bdist.win32\egg\ticketchange\web_ui.py", line 89, in process_requestFile "build\bdist.win32\egg\ticketchange\web_ui.py", line 176, in _update_ticket_comment
System Information:
User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Trac: 0.11.7 Python: 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] setuptools: 0.6c11 SQLite: 3.3.4 pysqlite: 2.3.2 Genshi: 0.5.1 mod_python: 3.3.1 Pygments: 1.3.1 Subversion: 1.6.6 (r40053) RPC: 1.0.6 jQuery: 1.2.6
comment:3 Changed 15 years ago by
| Owner: | changed from Sergei Luchko to Ryan J Ollos |
|---|---|
| Status: | new → assigned |
This can be fixed by proper use of trac.util.datefmt.
comment:4 Changed 15 years ago by
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note: See
TracTickets for help on using
tickets.



Some up of this bug in 0.11