It seems, that Django handles methods and variables indexes differently.
So I solved it this way:
e = IndexError()
e.silent_variable_failure = True
raise e
Martin
On Wed, 21 Sep 2011 23:36:58 +0200, Martin Tiršel
wrote:
Hello,
I have this situation:
class SomeClass(object):
...
Hello,
I have this situation:
class SomeClass(object):
...
def __getitem__(self, key):
...
raise IndexError()
and now:
context['somevar'] = {'one': 1, }
context['anothervar'] = SomeClass()
in template:
{{ somevar.one }} - prints 1
{{ somevar.two }} - prints nothing,
2 matches
Mail list logo