Ticket #10775 (new defect)

Opened 4 months ago

Last modified 4 months ago

KeyError: 'utc'

Reported by: falkb Assigned to: asic_druide
Priority: normal Component: WikiFormsPlugin
Severity: normal Keywords:
Cc: Trac Release: 1.0

Description

I installed it, used your example, changed a form value, pressed the "Send" button and "KeyError?: 'utc'" appears:

File ".../Trac-1.0-py2.7.egg-tmp/trac/ticket/templates/ticket_box.html", line 109, in <Expression u'wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)'>
  ${wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)}
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1546, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1501, in generate
  escape_newlines)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1244, in format
  self.handle_code_block(line, block_start_match)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1134, in handle_code_block
  processed = self.code_processor.process(code_text)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 356, in process
  text = self.processor(text)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 343, in _macro_processor
  text)
File "build/bdist.win32/egg/wikiforms/wikiforms.py", line 520, in expand_macro
  time_string   = format_datetime(last_modified,'%a %b %d %T %Y %Z',timezone(timezone_name))								   
File "build/bdist.win32/egg/trac/util/datefmt.py", line 874, in timezone
  return _tzmap[tzname]

Attachments

Change History

01/09/13 11:35:55 changed by anonymous

...seems that 'utc' is not a valid timezone (you might try 'UTC' instead) or set a timezone (e.g. CET) in trac.ini.

[trac]
default_timezone = CET

01/09/13 11:40:37 changed by falkb

I changed the code from 'utc' to 'UTC' and it seems I get one step further, though stopped on the next error which is "ValueError?: Invalid format string":

File ".../Trac-1.0-py2.7.egg-tmp/trac/ticket/templates/ticket_box.html", line 109, in <Expression u'wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)'>
  ${wiki_to_html(context, ticket.description, escape_newlines=preserve_newlines)}
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1546, in format_to_html
  return HtmlFormatter(env, context, wikidom).generate(escape_newlines)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1501, in generate
  escape_newlines)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1244, in format
  self.handle_code_block(line, block_start_match)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 1134, in handle_code_block
  processed = self.code_processor.process(code_text)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 356, in process
  text = self.processor(text)
File "build/bdist.win32/egg/trac/wiki/formatter.py", line 343, in _macro_processor
  text)
File "build/bdist.win32/egg/wikiforms/wikiforms.py", line 520, in expand_macro
  time_string   = format_datetime(last_modified,'%a %b %d %T %Y %Z',timezone(timezone_name))								   
File "build/bdist.win32/egg/trac/util/datefmt.py", line 219, in format_datetime
  return _format_datetime_without_babel(t, format, tzinfo)
File "build/bdist.win32/egg/trac/util/datefmt.py", line 184, in _format_datetime_without_babel
  text = t.strftime(str(format))

01/09/13 11:45:08 changed by falkb

changing line 520 to

time_string   = format_datetime(last_modified

let the plugin run without error. The output may not be as you indented. The form displays now: Last Modified: 1/9/2013 10:27:32 AM (77 minutes ago) by falkb


Add/Change #10775 (KeyError: 'utc')




Change Properties
Action