irregular controller names

4 views
Skip to first unread message

kevin...@gmail.com

unread,
Jan 8, 2007, 8:11:14 AM1/8/07
to TurboGears
Hi all,

Anyone know if it's possible to create irregular controller names in
Turbogears. Or aliases.

I'm basically wanting to emulate a legacy interface with my app, which
means that I need to support a URL of the form
http://mysite.com/opt_out.php?email=address&pass=secret

Can I do this somehow?

Thanks,

Stuart

Alberto Valverde

unread,
Jan 8, 2007, 9:02:13 AM1/8/07
to turbo...@googlegroups.com

You can define a "default" method in your Root controller. Something
like:


class Root(RootController):
class default(self, *args, **kw):
args = list(args)
try:
atom = args.pop(0)
except KeyError:
raise cherrypy.NotFound
if atom == "opt_out.php":
return self.aliased_method(*args, **kw)
raise cherrypy.NotFound

HTH,
Alberto

Reply all
Reply to author
Forward
0 new messages