Message from discussion
irregular controller names
Received: by 10.35.111.17 with SMTP id o17mr7594615pym.1168264945397;
Mon, 08 Jan 2007 06:02:25 -0800 (PST)
Return-Path: <albe...@toscat.net>
Received: from mail.toscat.com (ded703-deb-163-3.netsonic.net [66.180.163.3])
by mx.google.com with ESMTP id z53si10110393pyg.2007.01.08.06.02.25;
Mon, 08 Jan 2007 06:02:25 -0800 (PST)
Received-SPF: neutral (google.com: 66.180.163.3 is neither permitted nor denied by best guess record for domain of albe...@toscat.net)
Received: from [87.235.104.177] (helo=[192.168.1.118])
by mail.toscat.com with esmtpsa
(Cipher TLS-1.0:RSA_AES_128_CBC_SHA:16) (Toscatmailer 1.0)
id 1H3v4w-0006fT-EV
for <turbogears@googlegroups.com>; Mon, 08 Jan 2007 15:02:24 +0100
Mime-Version: 1.0 (Apple Message framework v752.3)
In-Reply-To: <1168261874.970417.272190@42g2000cwt.googlegroups.com>
References: <1168261874.970417.272190@42g2000cwt.googlegroups.com>
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
Message-Id: <F5596780-51CA-42E0-9897-59FDBA8C4B79@toscat.net>
Content-Transfer-Encoding: 7bit
From: Alberto Valverde <albe...@toscat.net>
Subject: Re: [TurboGears] irregular controller names
Date: Mon, 8 Jan 2007 15:02:13 +0100
To: turbogears@googlegroups.com
X-Mailer: Apple Mail (2.752.3)
X-Spam-Bar: ---
X-Spam-Score: -3.6
On Jan 8, 2007, at 2:11 PM, kevinvi...@gmail.com wrote:
>
> 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?
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