I modified the core product/models.py code to add some print
statements:
~~~~~~~~~~~~~~~~~
    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())
                    print "########### app =      " + app
                    print "########### subtype =  " + subtype
                    print "########### subclass = " + str(subclass)
                    gettype = getattr(subclass, '_get_subtype')
                    print "########### gettype = " + str(gettype)
                    print ""
                    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

~~~~~~~~~~~~~~~~~

If i load /admin/product/product i get this kind of list for existing
products ("Base Product" is the name of the product I created from a
plain Product and used as a custom order product):
########### app =      product
########### subtype =  ConfigurableProduct
########### subclass = robot-attack
########### gettype = <bound method ConfigurableProduct._get_subtype
of <ConfigurableProduct: robot-attack>>

########### app =      product
########### subtype =  CustomProduct
########### subclass = CustomProduct: Base Product
########### gettype = <bound method CustomProduct._get_subtype of
<CustomProduct: CustomProduct: Base Product>>

########### app =      product
########### subtype =  CustomProduct
########### subclass = CustomProduct: Base Product
########### gettype = <bound method CustomProduct._get_subtype of
<CustomProduct: CustomProduct: Base Product>>

########### app =      product
########### subtype =  CustomProduct
########### subclass = CustomProduct: Base Product
########### gettype = <bound method CustomProduct._get_subtype of
<CustomProduct: CustomProduct: Base Product>>

When I try to add a new custom product from my MyCustomProduct class,
I error out on MyCustomProduct' object has no attribute '_get_subtype'
and get this:

########### app =      my_app
########### subtype =  MyCustomProduct
########### subclass = Test special product
[28/Oct/2009 13:58:17] "POST /admin/my_app/mycustomproduct/add/ HTTP/
1.1" 500 109954


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
-~----------~----~----~----~------~----~------~--~---

Reply via email to