Displaying certain issues fails with "Templating error"

Bug #673677 reported by Malte Helmert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
roundup (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: roundup

Since lucid (and still in maverick, but not in karmic), one issue in our internal issue tracker fails to display, apparently due to a date that is messed up in some way. I also can't edit it via the command-line admin interface, so in the end I had to edit /usr/lib/pymodules/python2.6/roundup/date.py as follows to work around the problem:

--- /home/helmert/tmp/date_orig.py 2010-11-10 19:39:27.000000000 +0100
+++ /usr/lib/pymodules/python2.6/roundup/date.py 2010-11-10 19:34:07.000000000 +0100
@@ -148,6 +148,8 @@
 def _utc_to_local(y,m,d,H,M,S,tz):
     TZ = get_timezone(tz)
     frac = S - int(S)
+ if S < 0: S = 0 ## [Malte]
+ if S > 59: S = 59 ## [Malte]
     dt = datetime.datetime(y, m, d, H, M, int(S), tzinfo=UTC)
     y,m,d,H,M,S = dt.astimezone(TZ).timetuple()[:6]
     S = S + frac

I don't know why the date is corrupted, but the issue tracker is not special in any way (classic template, no external tools messing with it, no customizations).

This only happens for very few issues, but with those it happens consistently.

Here's the traceback that is emailed to the admins:

  Templating Error

*<type 'exceptions.ValueError'>*: second must be in 0..59

Debugging information follows

   1. A problem occurred in your template "issue.item.html".

Full traceback:

Traceback (most recent call last):
   File "/usr/lib/pymodules/python2.6/roundup/cgi/client.py", line 1042, in renderContext
     result = pt.render(self, None, None, **args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/templating.py", line 343, in render
     getEngine().getContext(c), output, tal=1, strictinsert=0)()
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 192, in __call__
     self.interpret(self.program)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 666, in do_useMacro
     self.interpret(macro)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 411, in do_optTag_tal
     self.do_optTag(stuff)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 396, in do_optTag
     return self.no_tag(start, program)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 391, in no_tag
     self.interpret(program)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 689, in do_defineSlot
     self.interpret(slot)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 632, in do_condition
     self.interpret(block)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 632, in do_condition
     self.interpret(block)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 608, in do_loop_tal
     self.interpret(block)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 411, in do_optTag_tal
     self.do_optTag(stuff)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 396, in do_optTag
     return self.no_tag(start, program)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 391, in no_tag
     self.interpret(program)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 236, in interpret
     handlers[opcode](self, args)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 555, in do_insertTranslation
     xlated_msgid = self.translate(msgid, default, i18ndict, obj)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 618, in translate
     msgid, i18ndict, default=default)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TranslationService.py", line 90, in translate
     target_language=target_language)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TranslationService.py", line 34, in translate
     _msg = TALInterpreter.interpolate(_msg, mapping)
   File "/usr/lib/pymodules/python2.6/roundup/cgi/TAL/TALInterpreter.py", line 72, in interpolate
     subst = ustr(mapping[var])
   File "/usr/lib/pymodules/python2.6/roundup/cgi/templating.py", line 1287, in __str__
     return self.plain()
   File "/usr/lib/pymodules/python2.6/roundup/cgi/templating.py", line 1679, in plain
     return str(self._value.local(offset))
   File "/usr/lib/pymodules/python2.6/roundup/date.py", line 527, in local
     self.hour, self.minute, self.second, offset)
   File "/usr/lib/pymodules/python2.6/roundup/date.py", line 151, in _utc_to_local
     dt = datetime.datetime(y, m, d, H, M, int(S), tzinfo=UTC)
ValueError: second must be in 0..59

Revision history for this message
Malte Helmert (helmert) wrote :

Hmmm, Somehow the indentation in the diff is messed up. The "if" lines should of course be indented to the same depth as the preceding lines.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.