durusmail: quixote-users: legal py & uri names don't overlap...
legal py & uri names don't overlap...
2004-04-05
2004-04-05
2004-04-05
2004-04-05
legal py & uri names don't overlap...
Jason E. Sibre
2004-04-05
Kendall,

_q_lookup is your friend here.  It may seem ugly, just to accomodate an
illegal (but static) name, but the alternative is even uglier, IMO.

_q_exports = ['illegal-name']

import sys
def illegalName(request):
    return "blah"

m = sys.modules[__name__]
setattr(m,'illegal-name',illegalName)


Jason




> -----Original Message-----
> From: quixote-users-bounces+jsibre=chironsys.com@mems-exchange.org
> [mailto:quixote-users-bounces+jsibre=chironsys.com@mems-exchange.org]On
> Behalf Of Kendall Clark
> Sent: Monday, April 05, 2004 11:48 AM
> To: quixote-users@mems-exchange.org
> Subject: [Quixote-users] legal py & uri names don't overlap...
>
>
> Peeps,
>
> I thought this might be a FAQ, but after grepping the archive of this
> list, I'm either grepping for the wrong thing or it's an IAQ. Anyway,
> I can have perfectly legal URIs which have components that aren't
> legal Python variables. The hyphen/dash is the obvious one:
>
> http://monkeyfist.com/rdf-model/foo
>
> which I'd like to map to:
>
> _q_exports = ["rdf-model"] where "rdf-model" is an instance of a
> ModelDispatch class. But, clearly, "rdf-model" isn't a legal Python
> variable name (alas -- my #1 Python wart!).
>
> What is the general trick to having URI path components with "-" and
> other illegal Python variable characters mapped to Python bits in
> Quixote? I'd prefer a solution other than doing a dynamic lookup; that
> will work in some cases, but not in others (I guess it will *work* in
> all cases, but ugh!).
>
> Thanks,
> Kendall Clark
> --
> Sometimes it's appropriate, even patriotic, to be ashamed
> of your country. -- James Howard Kunstler
>
> _______________________________________________
> Quixote-users mailing list
> Quixote-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/quixote-users
>



reply