Metaclasses

Bob.Cowdery at CGI-Europe.com Bob.Cowdery at CGI-Europe.com
Wed Dec 22 08:48:02 EST 2004


Hi
 
I am trying to build a capability based API. That is, an instance of the api
will reflect the capabilities of some underlying services. I could have
several different instances of the api concurrently running against
different back end services. A ui applet will bind to an api instance. I
want to make this easy to use from the ui perspective so I envisage exposing
a number of properties as the variable part can be represented by
properties. I want a property to exist only if a capability is available so
it is easily tested. I have tried using Property and Metaclasses to do this
and although both work I can't figure out how to make multiple different
instances as both get executed on 'import' and thus only one instance can be
created. Inside the metaclass I have to get hold of the capability map I
want to build the instance against. The only way I can see to do this at the
moment is to have a metaclass for each capability type and hardcode the type
inside it, then pick the appropriate metaclass when I build the
implementation class.
 
Regards
Bob
 
 
 
Bob Cowdery
CGI Senior Technical Architect
+44(0)1438 791517
Mobile: +44(0)7771 532138
bob.cowdery at cgi-europe.com <mailto:bob.cowdery at cgi-europe.com> 
 
 
 

*** Confidentiality Notice *** Proprietary/Confidential
Information belonging to CGI Group Inc. and its affiliates
may be contained in this message. If you are not a recipient
indicated or intended in this message (or responsible for
delivery of this message to such person), or you think for
any reason that this message may have been addressed to you
in error, you may not use or copy or deliver this message
to anyone else.  In such case, you should destroy this
message and are asked to notify the sender by reply email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20041222/72cbf93a/attachment.html>


More information about the Python-list mailing list