Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1103 (closed defect: worksforme)

Opened 13 years ago

Last modified 9 years ago

String collection fails

Reported by: guzru Owned by: anonymous
Priority: normal Milestone: 1.0.x bugfix
Component: Toolbox.admi18n Version: 0.9a6
Severity: major Keywords:

Description (last modified by jorge.vargas) (diff)

i18n (command line) and admi18n cannot collect simple strings like _('hello'). The line which triggers the error is:

turbogears.flash(_('Under development...'))

This is the stack trace:

Page handler: <function _wrapper at 0xae9d61ec>
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 105, in _run
  File "/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 254, in main
    body = page_handler(*virtual_path, **self.params)
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/identity/conditions.py", line 275, in _wrapper
    return fn( *args, **kw )
  File "<string>", line 3, in string_collection
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/controllers.py", line 331, in expose
    output = database.run_with_transaction(
  File "<string>", line 5, in run_with_transaction
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/database.py", line 245, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/controllers.py", line 348, in <lambda>
    mapping, fragment, *args, **kw)))
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/controllers.py", line 372, in _execute_func
    output = errorhandling.try_call(func, *args, **kw)
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/errorhandling.py", line 71, in try_call
    return func(self, *args, **kw)
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/toolbox/admi18n/__init__.py", line 291, in string_collection
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/toolbox/admi18n/__init__.py", line 251, in collect_string_for_files
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/toolbox/admi18n/pygettext.py", line 728, in main
    tokenize.tokenize(fp.readline, eater)
  File "/usr/lib/python2.4/tokenize.py", line 153, in tokenize
    tokenize_loop(readline, tokeneater)
  File "/usr/lib/python2.4/tokenize.py", line 160, in tokenize_loop
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/toolbox/admi18n/pygettext.py", line 396, in __call__
    self.__state(ttype, tstring, stup[0])
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/toolbox/admi18n/pygettext.py", line 447, in __openseen
  File "/usr/lib/python2.4/site-packages/TurboGears-0.9a9-py2.4.egg/turbogears/toolbox/admi18n/pygettext.py", line 471, in __addentry
    msg = eval(repr(msg)[1:])
  File "<string>", line 1
    Under development...'
SyntaxError: invalid syntax

It does not fail upon strings with parameters like: 

turbogears.flash(_('%(name)s %(surname)s saved!' % {'name':data['name'], 'surname':data['surname']}))

I'm using version 0.9a9.

Change History

comment:1 Changed 13 years ago by guzru

  • Component changed from CherryPy to TurboGears

comment:2 Changed 13 years ago by guzru

  • Milestone changed from 0.9 to 0.9a7

comment:3 Changed 13 years ago by khorn

  • Milestone 0.9a7 deleted

milestone passed, removing milestone

comment:4 Changed 13 years ago by jorge.vargas

  • Component changed from TurboGears to Toolbox.admi18n
  • Description modified (diff)
  • Milestone set to 1.0

comment:5 Changed 12 years ago by alberto

  • Milestone changed from 1.0 to 1.1

comment:6 Changed 12 years ago by alberto

  • Milestone changed from 1.1 to __unclassified__

Batch moved into unclassified from 1.1 to properly track progress on the later

comment:7 Changed 12 years ago by faide

  • Status changed from new to closed
  • Resolution set to worksforme

I tried just the example string in either i18n command line and in toolbox and I was able to collect/merge/compile with each...

I am using 1.0.3dev...

So I consider this problem as solved. Feel free to add more details if you still encounter a problem.

comment:8 Changed 9 years ago by chrisz

  • Milestone changed from __unclassified__ to 1.0.x bugfix
Note: See TracTickets for help on using tickets.