Modify

Opened 15 years ago

Closed 12 years ago

Last modified 12 years ago

#4820 closed defect (fixed)

[Patch] UnicodeDecode Error line 50 in ticketdeletete_admin.html

Reported by: ngolovin@… Owned by: Noah Kantrowitz
Priority: normal Component: TicketDeletePlugin
Severity: normal Keywords:
Cc: Matthijs Kooijman Trac Release: 0.11

Description

Was solved by changing the line 50 as follows:

<td colspan="3" py:with="ptime=unicode(ticketdelete.
changes[change].prettytime.decode('utf-8'))"><b>Change 
at ${ptime} by ${ticketdelete.changes[change].author}</b></td>

I have german locale setting, that might be the reason why prettytime contains characers that genshi doesn't like.

Attachments (0)

Change History (13)

comment:1 Changed 15 years ago by anonymous

I hit this and fixed it by using the locale format "%x %X":

  • ticketdelete/web_ui.py

     
    102102                        c_data['author'] = author
    103103                        # FIXME: The datetime handling is not working - enable
    104104                        # for traceback
    105                         c_data['prettytime'] = strftime('%a, %d %b %Y %H:%M:%S',time.timetuple())
     105                        c_data['prettytime'] = strftime('%x %X',time.timetuple())
    106106                   
    107107                    # Check the boxes next to change number `selected`
    108108                    time_list = list(sorted(ticket_data.iterkeys()))

comment:3 Changed 15 years ago by gebb@…

Here is an alternative patch.

  • ticketdelete/web_ui.py

     
    88from trac.web.api import IRequestFilter
    99from trac.web.chrome import ITemplateProvider, add_script, add_stylesheet
    1010from trac.util import sorted
    11 from trac.util.datefmt import to_datetime, utc, to_timestamp
     11from trac.util.datefmt import to_datetime, utc, to_timestamp, format_datetime
    1212
    1313import re
    1414import traceback
     
    100100                        c_data = ticket_data.setdefault(to_timestamp(time), {})
    101101                        c_data.setdefault('fields', {})[field] = {'old': oldvalue, 'new': newvalue}
    102102                        c_data['author'] = author
    103                         # FIXME: The datetime handling is not working - enable
    104                         # for traceback
    105                         c_data['prettytime'] = strftime('%a, %d %b %Y %H:%M:%S',time.timetuple())
     103                        c_data['prettytime'] = format_datetime(time, '%a, %d %b %Y %H:%M:%S')
    106104                   
    107105                    # Check the boxes next to change number `selected`
    108106                    time_list = list(sorted(ticket_data.iterkeys()))

comment:4 Changed 15 years ago by Ryan J Ollos

Summary: UnicodeDecode Error line 50 in ticketdeletete_admin.html[Patch] UnicodeDecode Error line 50 in ticketdeletete_admin.html

comment:5 Changed 14 years ago by Jens Langner

I run into the same problem with my german python installation. I tried both patches, but the patch with

strftime('%x %X',time.timetuple())

seems more appropriate because the other one still inserts german month names into the web display while the other components of trac are displayed in english. Here I just changed the locale for displaying times like "DD.MM.YYYY" instead of "MM/DD/YYYY". So "%x %X" seems to be more appropriate.

comment:6 Changed 14 years ago by Matthijs Kooijman

Cc: Matthijs Kooijman added; anonymous removed

I've also seen this problem with a french locale. Using the %x %X patch works for me. Any chance to include this?

comment:7 Changed 12 years ago by Boris Savelev

comment:3 works for me too (for russian users).

comment:7 Changed 12 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

(In [11790]) Fixes #4820: Use trac.util.datefmt.format_datetime from Trac for proper handling of the locale.

comment:8 Changed 12 years ago by Ryan J Ollos

If anyone is still using this plugin, I appreciate if you can post feedback on whether [11790] fixed the issue.

comment:9 Changed 12 years ago by Matthijs Kooijman

I'm still using this plugin every other day or so to delete spam tickets :-D

I just tried 2.0.1 to find a ticket where the problem occurred and then 2.0.2 / r11790 which fixes the problem for me (french locale).

Thanks!

comment:10 Changed 12 years ago by Ryan J Ollos

#8346 closed as a duplicate.

comment:11 Changed 12 years ago by Ryan J Ollos

matthijs: Thanks for reporting back. The plugin is no longer needed with Trac 0.12, but I'm trying to wrap up the major issues that affect 0.11 users, since it appears there are still several people using this plugin. If any of the open issues are affecting you, please assign the tickets to me and I'll get them fixed.

comment:12 Changed 12 years ago by Matthijs Kooijman

We're still running on 0.11, so ticketdelete is useful for me still. I just looked through the list of tickets, there's nothing that I've ran into on first glance, so everything is pretty functional for me. I think there was some issue with deleting changes (IIRC using the checkmarks on complete changes didn't work or something, but the Delete Change button did), but that doesn't really bother me, so I'm fine!

comment:13 Changed 12 years ago by Ryan J Ollos

Thanks for checking. I'll CC you on any other tickets that I make changes against, in case you might have an interest in the fix.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Noah Kantrowitz.
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.