turbogears2

Redirect to home when a 403 error occoured in Turbogears 3

I am in a standard paster-generated turbogears 2 project. I am using: allow_only = not_anonymous(msg=l_(u'You must be logged in')) And I am using generated error.py controller. The issue is that I want to redirect the user to the front page('/') when the error controller identifies and 403 error. Then I have tried tg.redirect(url('...

Return another controller method inside a controller method in turbogears 2

In turbogears 1 that was easy: Class controller(Controller) @expose() def method1(self, **kw): print 'bla' return self.method2(**kw) @expose('template2') def method2(self, **kw): print 'bli' return dict(**kw) when I call method1, what I got was the template2 called by method2. but in t...

How to transfer url parameters to repoze custom predicate checkers

I would like to create a repoze custom predicate checker that is capable to access url parameters and validate something. But I would like to use allow_only to set this permission checker in all the controller's scope. Something like: class MyController(BaseController): allow_only = All(not_anonymous(msg=l_(u'You must be logged on'...

Simple ascii url encoding with python

look at that: import urllib print urllib.urlencode(dict(bla='Ã')) the output is bla=%C3%BC what I want is simple, I want the output in ascii instead of utf-8, so I need the output: bla=%C3 if I try: urllib.urlencode(dict(bla='Ã'.decode('iso-8859-1'))) doesn't work (all my python files are utf-8 encoded): 'ascii' codec can't ...

Log controller requests to syslog in tg2

Is there any built-in automate way to log controller request events to system log? ...

How to use mod_passenger for Turbogears 2?

What do I put in passenger_wsgi.py for a Turbogears2 site? Since it's possible for Django to use mod_passenger, I'm trying to use mod_passenger with Turbogears2. So far, I've found a passenger_wsgi.py for Turbogears1, but I don't know where to start to make a passenger_wsgi.py for a Turbogears2 site. Here's the Turbogears1 example: ht...