[Product-Developers] subclass ATWorkgroup

cswank craig_swank at nrel.gov
Wed Jun 17 13:11:18 UTC 2009




Andreas Jung-5 wrote:
> 
> On 16.06.09 22:24, cswank wrote:
>> Hello,
>> I am trying to subclass ATWorkgroup.  When my __init__:
>>
>> def __init__(self, *args, **kw):
>>         super(Vendor, self).__init__(*args, **kw)
>>
>>  gets called I get the following error:
>>
>> TypeError: super(type, obj): obj must be an instance or subtype of type
>>   
> 
> And where is the class definition? Please provide consistent and half-way
> sense-making code snippets.
> 
> Andreas
> 
> 
> My class definition is as such:
> 
> class Vendor(ATWorkgroup):
>     """Description of the Example Type"""
>     implements(IVendor)
> 
>     meta_type = "Vendor"
>     schema = VendorSchema
> 
>     title = atapi.ATFieldProperty('title')
>     description = atapi.ATFieldProperty('description')
>     
>     # -*- Your ATSchema to Python Property Bridges Here ... -*-
>     vendor_id = atapi.ATFieldProperty('vendorID')
> 
>     actions = ATWorkgroup.actions
> 
>     schema["title"].required = 0
>     schema["title"].widget.visible = {"edit":"hidden", "view":"visible"}
>     schema["title"].widget = atapi.SelectionWidget()
>     schema["title"].vocbulary_factory = u'.nrel.hydrogen.manufacturers'
>     schema["description"].widget.visible = {"edit":"hidden",
> "view":"hidden"}
>     schema["vendorID"].widget.visible = {"edit":"visible",
> "view":"hidden"}
> 
>      def __init__(self, *args, **kw):
>         super(Vendor, self).__init__(*args, **kw)
> 
> And more detail on what is happening in the __init__ when I set a pdb
> trace:
> ipdb> self
> Out[0]: <Vendor at >
> ipdb> isinstance(self, Vendor)
> Out[0]: False
> 
> 
> 
> begin:vcard
> fn:Andreas Jung
> n:Jung;Andreas
> org:ZOPYX Ltd. & Co. KG
> adr;quoted-printable:;;Charlottenstr. 37/1;T=C3=BCbingen;;72070;Germany
> email;internet:info at zopyx.com
> title:CEO
> tel;work:+49-7071-793376
> tel;fax:+49-7071-7936840
> tel;home:+49-7071-793257
> x-mozilla-html:FALSE
> url:www.zopyx.com
> version:2.1
> end:vcard
> 
> 
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> http://lists.plone.org/mailman/listinfo/product-developers
> 
> 

-- 
View this message in context: http://n2.nabble.com/subclass-ATWorkgroup-tp3088643p3092653.html
Sent from the Product Developers mailing list archive at Nabble.com.





More information about the Product-Developers mailing list