Awesome idea. For posterity, here's what I came up with that works for
me. Maybe this will help someone else too:
* Create a simple filter in a file called LoginFilter.py and put that
file alongside your controller file:
from cherrypy.filters.basefilter import BaseFilter
import cherrypy
class LoginFilter(BaseFilter):
def before_main(self):
#is this our magic login form?
login = cherrypy.request.params.get('login', None)
if login == 'Login':
user_name = cherrypy.request.params['user_name']
#do with it what you will, like log if there was an
invalid login attempt
* In controllers.py, add this line of code to import the filter: from
LoginFilter import LoginFilter
* In controllers.py, add this line inside of the Root class to make TG
use the filter: _cp_filters = [LoginFilter()]
Thanks again for the suggestion!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---