Class s.l.c.Adaptable(object):

Part of stoqlib.lib.component View In Hierarchy

Known subclasses: stoqlib.domain.base.AdaptableORMObject

Adapter base class, everything you want to adapt must subclass this.
Method __init__ Undocumented
Class Method getFacetType Fetches a facet type associated with an interface, or raise
Class Method getFacetTypes Returns facet classes for this object
Class Method registerFacet Registers a facet for class cls.
Method addFacet Adds a facet implementing iface for the current object
Method removeFacet Removes a facet from the current object
Method getFacets Gets a list of facets assoicated with the current object.
def __init__(self):
Undocumented
@classmethod
def getFacetType(cls, iface):
Fetches a facet type associated with an interface, or raise LookupError if the facet type cannot be found.
Parametersifaceinterface name for the facet to grab
Returnsthe facet type for the interface
@classmethod
def getFacetTypes(cls):
Returns facet classes for this object
Returnsa list of facet classes
@classmethod
def registerFacet(cls, facet, *ifaces):
Registers a facet for class cls.

The 'facet' argument is an adapter class which will be registered using its interfaces specified in __implements__ argument.

Notes: the assigned key will have the name of the class cls.

Parameterscls
facet
ifacesoptional list of interfaces to attach
def addFacet(self, iface, *args, **kwargs):
Adds a facet implementing iface for the current object
Parametersifaceinterface of the facet to add
Returnsthe facet
def removeFacet(self, iface, *args, **kwargs):
Removes a facet from the current object
Parametersifaceinterface of the facet to remove
def getFacets(self):
Gets a list of facets assoicated with the current object.
Returnsa list of facets
API Documentation for Stoqlib, generated by pydoctor at 2009-07-14 16:00:32.