durusmail: quixote-users: Warn if attribute is not in _q_exports
Warn if attribute is not in _q_exports
2004-11-23
Warn if attribute is not in _q_exports
Thomas Guettler
2004-11-23
Hi,

If you access a component which exists, but is not in _q_exports,
it would be nice to get better message.

Security: This way you can test which attributes exist and
which don't exist. But if you don't trust your users, you
should set SECURE_ERRORS to True.

Patch is attached.

 Thomas


--- publish.py_orig     2004-11-23 14:52:30.957496912 +0100
+++ publish.py  2004-11-23 14:42:25.181588848 +0100
@@ -804,6 +804,11 @@
                           "be replaced by _q_lookup()" % type(container))
             object = container._q_getname(request, component)
         if object is None:
+            if hasattr(container, component):
+                raise errors.TraversalError(
+                    private_msg="object %r has attribute %r, but it is not in
_q_exports" % (
+                    container,
+                    component))
             raise errors.TraversalError(
                 private_msg="object %r has no attribute %r" % (
                                                     container,

reply