On Mon, Apr 05, 2004 at 01:12:36PM -0400, Neil Schemenauer wrote:
> If you don't want to treat some names specially, you could have a
> standard pattern:
>
> def rdf_model(...):
> exports = {
> 'rdf-model': rdf_model,
> 'hello_world': hello_world,
> }
>
> def _q_lookup(request, component):
> return exports.get(component)
Thanks, Neil, for the options.
This suggests a helpful patch, though I have no idea whether it would
break existing code or work at all. In very pseudo code:
the_type = type(_q_exports)
if the_type == types.ListType:
elif the_type == types.DictionaryType:
else: ...
That would neatly (or so it seems) solve the URI/Py-variable name
mismatch issue, though maybe I'm the only Quixote user who
systematically prefers "-" in URIs to "_", in which case it hardly
matters. :>
My hesitation to using _q_lookup to get around the naming mismatch has
more to do with my totally uninformed hunch that it's slower than
finding the same thing more "statically" (?) in a _q_exports. Well,
uninformed worries about it being "slower", and it just seems wrong,
since it's a hack to get around the name mismatch.
Best,
Kendall Clark
--
Habitation creates space; space only exists because we do.