Right now you pretty much have to use strings like
"mako:myproject.templates.index" for your expose methods.
You can manipulate the pylons buffet template object to set mako as
the default rendering engine, but it's a bit complex.
As soon as Pylons releases a new version which adds the hooks we need,
we'll do a release of TG2 where you can set the default renderer with
a simple config option in app_conf.py.
> - how can I configure the application to use webhelpers, to expose it
> as a global "h" ? (I've looked into app_globals.py but I did not seem
> to pick things up. and can webhelpers and toscawidgets be mixed
> together ?
it's setup in the load_environent by getting stuff from helpers.py
inside you application's lib directory.
> - what should I know about using TG2 (1.9.7) in a production
> environment ?
Well, TG2 is being used by a few people in production, and there are
two major schools. The mod_wsgi school and the nginx proxy school.
Both provide good performance, and are great ways to deploy your app.
And you can use any wsgi server, so there are lots and lots of
options.
Tg2 is a pretty thin layer over the top of some well tested
components, so I personaly would not be very hesitant to deploy TG2 in
production at the moment, but I would say that it depends more on your
app and your specific requirements than anything else.
> - is there a list of the availalble function decorators ?
The ones provided by TG are here:
http://www.turbogears.org/2.0/docs/modules/tgdecorators.html
Other API docs can be found linked from here:
http://www.turbogears.org/2.0/docs/modindex.html
> Cheers,
> >
>
--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog
Thanks for the quick reply!
expose decorators do work as I suspected which is great! more code
reuse:
@expose('json', exclude_names='d')
@expose('kid:blogtutorial.templates.test_form',
content_type='text/html')
def my_exposed_method(self):
return dict(a=1, b=2, d="username")
now for the webhelpers ... I did create a project and found the
helpers.py file but it was empty ? So I modify helpers.py by adding :
from webhelpers import *
Also I do I set mako in app_cfg.py or will
"mako:myproject.templates.index" suffice ?