fix __getattribute__ rstrip bug

fix_request_path_info
Bert Constantin 2010-01-17 22:50:23 +01:00
parent 889ce78f2e
commit 1ba36e9fb1
1 changed files with 3 additions and 2 deletions

View File

@ -995,8 +995,9 @@ class PolymorphicModel(models.Model):
# TODO: investigate Django how this can be avoided
def __getattribute__(self, name):
if name != '__class__':
modelname = name.rstrip('_ptr')
model = self.__class__.sub_and_superclass_dict.get(modelname, None)
#if name.endswith('_ptr_cache'): # unclear if this should be handled as well
if name.endswith('_ptr'): name=name[:-4]
model = self.__class__.sub_and_superclass_dict.get(name, None)
if model:
id = super(PolymorphicModel, self).__getattribute__('id')
attr = model.base_objects.get(id=id)