ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pyxpcom
pyxpcom
Re: [pyxpcom] Using (object) on the component's declaration
by Philip Semanchuk other posts by this author
Dec 1 2008 6:46AM messages near this date
view in the new Beta List Site
[pyxpcom] Using (object) on the component's declaration | Re: [pyxpcom] Using (object) on the component's declaration
On Dec 1, 2008, at 8:58 AM, Arthur Gouveia wrote:

>  Hi folks!
> 
>  I´m trying to make a PytXPCOM + XUL  + Storm(ORM) app.
> 
>  The problem I´m having is that when I declare a component (Python  
>  Class)
>  without using (object), the PyXPCOM registers it just fine, but when  
>  I use
>  (object), or when I say the class inherits from a class that inhetis  
>  object,
>  on my Class declaration, the pyxpcom doesn't register it.
> 
> 
>  *I need to use the (object) on my component because Storm throws an  
>  __mro__
>  Error if I don´t, when doing a select on my DB.*
> 
>  What's happening? Anyone here saw this before and came up with a  
>  solution?
>  What is the problem on using (object) on pyxpcom components?

Hi Arthur,
You diagnosed this correctly. PyXPCOM components must be "old-style"  
classes; i.e. they cannot inherit from object. As you said, the  
symptom is that one's class is simply not registered. I remember that  
this took me a long time to debug.

I don't know why this limitation exists, but I guess it is due to some  
of the assumptions made in the PyXPCOM code.

I don't know of a workaround except to restructure one's code.

Good luck
Philip



> 
> 
> 
>  This code doesn´t register prCustomer (or customer), but if I declare
>  "prCustomer:", it registers just fine.
> 
>  *# -*- coding: UTF-8 -*-
>  # vim: set ts=4 sw=4 :
> 
>  from xpcom import components
> 
>  class Customer(object):
>         pass
> 
>  class prCustomer(Customer):
>         _com_interfaces_ = components.interfaces.prICustomerService
>         _reg_clsid_ = "{aac45fb0-9ead-11dd-ad8b-0800200c9a66}"
>         _reg_contractid_ = "@taturana.net/testes/customer;1"
> 
>         def add(self, cust):
>               pass
>  *
> 
> 
>  -- 
>  Arthur Gouveia.
>  Bacharelando em Ciências da Computação - Unipê
>  http://arthurgouveia.com
> 
>  "De nihilo nihilum."
>  _______________________________________________
>  pyxpcom mailing list
>  pyxpcom@[...].com
>  To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

_______________________________________________
pyxpcom mailing list
pyxpcom@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Arthur Gouveia
Philip Semanchuk
Todd Whiteman

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved