Migrated issue, originally created by Anonymous
The method runtime.py:Namespace:__getattr__ raises RuntimeException when I think it should raise AttributeError.
This comes up when you try to do this in your template:
my_attr = getattr(my_namespace, my_attrname, None)
and there is no match for my_attrname. The expected behavior would be for None to be returned but instead RuntimeException does not get caught by getattr.
The use of AttributeError is mentioned here:
http://docs.python.org/reference/datamodel.html#object.__getattr__
Index: lib/mako/runtime.py
===================================================================
--- lib/mako/runtime.py (revision 441)
+++ lib/mako/runtime.py (working copy)
@@ -260,7 +260,7 @@
if self.inherits is not None:
return getattr(self.inherits, key)
- raise exceptions.RuntimeException("Namespace '%s' has no member '%s'" % (self.name, key))
+ raise AttributeError("Namespace '%s' has no member '%s'" % (self.name, key))
def supports_caller(func):
"""apply a caller_stack compatibility decorator to a plain Python function."""
Migrated issue, originally created by Anonymous
The method
runtime.py:Namespace:__getattr__raisesRuntimeExceptionwhen I think it should raiseAttributeError.This comes up when you try to do this in your template:
and there is no match for my_attrname. The expected behavior would be for None to be returned but instead
RuntimeExceptiondoes not get caught by getattr.The use of
AttributeErroris mentioned here:http://docs.python.org/reference/datamodel.html#object.__getattr__