On Wed, Sep 03, 2003 at 05:52:30PM +0400, Oleg Broytmann wrote:
> Neil, I am sure it would be very helpful to include your Redirector
> class in, say, util.py. Just add both _q_index and __call__...
I've added the Redirector class to util.py but something feels wrong
about needing both __call__ and _q_index. I just looked at publish.py
and see that _q_index is treated differently and is not passed to
_q_lookup(). I think that's wrong.If _q_index does not exist and
_q_lookup does exist then _q_lookup should get called with the component
parameter equal to "".
The attached patch fixes this. Anyone object to this change? I don't
think it should break existing code.
Neil
Index: publish.py
===================================================================
--- publish.py (revision 22369)
+++ publish.py (working copy)
@@ -766,8 +796,11 @@
object = getattr(container, component)
elif component == '_q_index':
- raise errors.AccessError(
- private_msg=("_q_index not found in %r" % container))
+ if hasattr(container, "_q_lookup"):
+ object = container._q_lookup(request, "")
+ else:
+ raise errors.AccessError(
+ private_msg=("_q_index not found in %r" % container))
elif hasattr(container, "_q_resolve"):
object = container._q_resolve(component)