I had this working previously, or rather I found a workaround for it that now fails.
I used the satchmo diaries example for creating a custom product class, and my code starting throwing the _get_subtype() errors: http://groups.google.com/group/satchmo-users/browse_thread/thread/adfff4982affea9f/d063a7d5cd6e2ca7 my class looks like this: #################### class MyProduct(Product): objects = ProductManager() field1 = models.CharField(_("Field #1"), max_length=100) field2 = models.CharField(_("Field #2"), max_length=100) def __unicode__(self): return self.name def _get_subtype(self): print " _get_subtype" return "MyProduct" class Meta: verbose_name = _('This is my Special Product') verbose_name_plural = _('These are my Special Products') #################### 1. With the above class, I get a loop repeatedly calling _get_subtype) _ until the server crashes 2. if I remove the _get_subtype() method, I get the error "Caught an exception while rendering: 'MyProduct' object has no attribute '_get_subtype'" 3. if i change the return value to "My Product", i get the error 'Product' object has no attribute 'cozybit product' (this was my previous workaround... I was able to create and access products built from this class) the error for #2 pointed to this code from the Product model: def get_subtypes(self): # If we've already computed it once, let's not do it again. # This is a performance speedup. if hasattr(self,"_sub_types"): return self._sub_types types = [] try: for key in config_value('PRODUCT', 'PRODUCT_TYPES'): app, subtype = key.split("::") try: subclass = getattr(self, subtype.lower()) gettype = getattr(subclass, '_get_subtype') subtype = gettype() if not subtype in types: types.append(subtype) except models.ObjectDoesNotExist: pass except SettingNotSet: log.warn("Error getting subtypes, OK if in SyncDB") self._sub_types = tuple(types) return self._sub_types The product class doesn't have a _get_subtype) method, but the other product classes do. I've deleted the product and rebuilt the db and run syncdb each time I get a failure with this. What should I be looking at? thanks, --derek --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
