I know this is a minor issue, but it's annoying.
The serializers of the new Kid version 0.9.4 have a "format" argument.
You can specify all kinds of output formatting here, including
auto-indentation (see http://kid-templating.org/guide.html#id4).
Please don't confuse this with the "format" argument of the TurboGears
expose decorator which actually corresponds to the "output" argument of
Kid serializers and determines whether you want xml, html, xhtml or
plain format.
Currently the format feature is not well integrated because it was not
there when TurboKid was written. You probably have to use it that way:
import kid
format_pretty = kid.HTMLSerializer(doctype='html', format='pretty')
@expose(template="...", format=format_pretty)
I think it would be good to integrate TurboKid into the next Kid release
(or even better, support the more generic API that is also used for
Genshi), and make it more easy to specify Kid's output format.
But I need some TurboGears expert to tell me exactly which methods Kid
should provide to support this API so that we can get rid of TurboKid.
You can make comments or suggestions concerning this issue here:
http://www.kid-templating.org/trac/ticket/188
-- Christoph
--------------------------
Page handler: <function _wrapper at 0xb62d61ec>
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
self.main()
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-1.0b2-py2.4.egg/turbogears/identity/conditions.py",
line 275, in _wrapper
return fn( *args, **kw )
File "<string>", line 3, in default
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py",
line 334, in expose
output = database.run_with_transaction(
File "<string>", line 5, in run_with_transaction
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-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-1.0b2-py2.4.egg/turbogears/controllers.py",
line 351, in <lambda>
mapping, fragment, args, kw)))
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py",
line 378, in _execute_func
output = errorhandling.try_call(func, *args, **kw)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/errorhandling.py",
line 71, in try_call
return func(self, *args, **kw)
File "/home/jackie/Projects/organizer/organizer/controllers.py", line
650, in default
return ctr.default(sect,sect_id,subsect,subsect_id,**kargs)
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/identity/conditions.py",
line 275, in _wrapper
return fn( *args, **kw )
File "<string>", line 3, in default
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py",
line 330, in expose
output = func._expose(func, accept, func._allow_json,
File "<string>", line 5, in _expose
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py",
line 351, in <lambda>
mapping, fragment, args, kw)))
File
"/usr/lib/python2.4/site-packages/TurboGears-1.0b2-py2.4.egg/turbogears/controllers.py",
line 389, in _execute_func
if template and template.startswith("."):
AttributeError: 'HTMLSerializer' object has no attribute 'startswith'
----------------------
It looks like turbogears is treating all format arguments as templates
Is this something I need to wait for future releases to use?
This should work out of the box with TurboGears 1.0b2 and Kid 0.9.4
installed; I just tried it out. Can you show me the controllers.py file
that produced this error?
-- Chris