getattr not working on Namespace

Issue #104 resolved
created an issue

The method 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:

Index: lib/mako/

--- lib/mako/ (revision 441) +++ lib/mako/ (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'" % (, key)) + raise AttributeError("Namespace '%s' has no member '%s'" % (, key))

def supports_caller(func): """apply a caller_stack compatibility decorator to a plain Python function."""