#678: [PATCH] Toolbox admi18n is not handling files grouping properly
------------------------------+---------------------------------------------
Reporter: roger.demetrescu | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone: 0.9
Component: Toolbox | Version:
Severity: normal | Resolution:
Keywords: |
------------------------------+---------------------------------------------
Comment (by roger.demetrescu):
Hi Simon,
{{{
>>> a,b,c = [],{},()
>>> for x in a,b,c:
print hasattr(x, "__iter__"),
True True True
}}}
If we use the hasattr() approach, it will break this code, because it will
flat even the dictionaries... :(
Just for the sake of sanity, I tried your suggestion and I got this error:
{{{
Page handler: <bound method Internationalization.string_collection of
<turbogears.toolbox.admi18n.Internationalization object at 0x012299D0>>
Traceback (most recent call last):
File "c:\python24\lib\site-packages\cherrypy-2.2.0rc1-
py2.4.egg\cherrypy\_cphttptools.py", line 99, in _run
self.main()
File "c:\python24\lib\site-packages\cherrypy-2.2.0rc1-
py2.4.egg\cherrypy\_cphttptools.py", line 248, in main
body = page_handler(*virtual_path, **self.params)
File "<string>", line 3, in string_collection
File "D:\Turbogears\turbogears\controllers.py", line 206, in expose
output = database.run_with_transaction(expose._expose,func, accept,
allow_json, allow_json_from_config,*args, **kw)
File "D:\Turbogears\turbogears\database.py", line 219, in
run_with_transaction
retval = func(*args, **kw)
File "<string>", line 5, in _expose
File "D:\Turbogears\turbogears\controllers.py", line 227, in <lambda>
expose._expose.when(rule)(lambda _func, accept, allow_json,
allow_json_from_config,*args,**kw: _execute_func(
File "D:\Turbogears\turbogears\controllers.py", line 245, in
_execute_func
output = errorhandling.try_call(func, *args, **kw)
File "D:\Turbogears\turbogears\errorhandling.py", line 59, in try_call
output = func(self, *args, **kw)
File "D:\Turbogears\turbogears\toolbox\admi18n\__init__.py", line 299,
in string_collection
return dict(project_files=self.project_files(),
File "D:\Turbogears\turbogears\toolbox\admi18n\__init__.py", line 252,
in project_files
return [x for x in flatten(fl) if not x["isdir"] or
visibility[x["path"]]]
TypeError: string indices must be integers
}}}
[]s
Roger
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/678>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---