From 1ba36e9fb14434d82ae10690c55347a59c6eb307 Mon Sep 17 00:00:00 2001 From: Bert Constantin Date: Sun, 17 Jan 2010 22:50:23 +0100 Subject: [PATCH] fix __getattribute__ rstrip bug --- poly/polymorphic.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/poly/polymorphic.py b/poly/polymorphic.py index 5477bc7..ce2a3c6 100644 --- a/poly/polymorphic.py +++ b/poly/polymorphic.py @@ -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)