[Zope3-Users] How to manually define an object's provided interfaces?

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Jun 1 08:51:54 EDT 2006


On Monday 29 May 2006 06:56, Frank Burkhardt wrote:
> Unfortunately, there is no 'provide' method on interfaces :-( .
>
> Now the questions:
>
> 1. Is the list of a content object's provided interfaces stored
> persistently in the Zodb?

Yes.

> 2. Is it according to Zope-, Python-, ... philosophy ok to danymically
> implement interfaces depending on the inner state of an object?

Yes.

> 3. How do I manually make objects provide or "unprovide" given interfaces?

zope.interface.directlyProvides(obj, ifaces) *overrides all* directly provided 
interfaces. For simply adding a a directly provided interface without 
deleting any others use zope.interface.alsoProvides(obj, ifaces). A good 
usage example is setting the skin on a request.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list