I have some class with custom getter for specific attr:
class Item(a, b, c, d, models.Model):
title = Field()
description = Field()
a = Field()
_custom_getter = ['title','description']
def __getattribute__(self, name):
if name in self.custom_getter:
return 'xxx'
else:
return super(Item, self).__getattribute__(name)
this code raise RunetimeError
: maximum recursion depth exceeded while calling a Python object
but when i use this piece of code:
class Item(a, b, c, d, models.Model):
title = Field()
description = Field()
a = Field()
def __getattribute__(self, name):
custom_getter = ['title','description']
if name in custom_getter:
return 'xxx'
else:
return super(Item, self).__getattribute__(name)
all works like I want. Wher is my mistake in first piece of code ?