Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
CMFPlone.InterfaceTool.InterfaceTool Class Reference
Inheritance diagram for CMFPlone.InterfaceTool.InterfaceTool:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.InterfaceTool.InterfaceTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def objectImplements
def classImplements
def namesAndDescriptions
def getInterfacesOf
def getBaseInterfacesOf
def getInterfaceInformations

Static Public Attributes

string id = 'portal_interface'
string meta_type = 'Portal Interface Tool'
tuple security = ClassSecurityInfo()

Static Private Attributes

tuple __implements__

Detailed Description

This tool exposes the interface package for TTW applications,
by accepting a dotted name of an interface and exporting the
IInterface API 

Definition at line 22 of file InterfaceTool.py.


Member Function Documentation

def CMFPlone.InterfaceTool.InterfaceTool.classImplements (   self,
  obj,
  dotted_name 
)
Asserts if an object's class implements a given interface 

Definition at line 44 of file InterfaceTool.py.

00044 
00045     def classImplements(self, obj, dotted_name):
00046         """ Asserts if an object's class implements a given interface """
00047         klass = aq_base(obj).__class__
00048         iface = resolveInterface(dotted_name)
00049         return iface.isImplementedBy(klass)

Here is the call graph for this function:

Returns all base interfaces of an object but no direct interfaces

Base interfaces are the interfaces which are the super interfaces of the
direct interfaces

Definition at line 70 of file InterfaceTool.py.

00070 
00071     def getBaseInterfacesOf(self, object):
00072         """Returns all base interfaces of an object but no direct interfaces
00073 
00074         Base interfaces are the interfaces which are the super interfaces of the
00075         direct interfaces
00076         """
00077         ifaces = self.getInterfacesOf(object)
00078         bases = []
00079         for iface in ifaces:
00080             visitBaseInterfaces(iface, bases)
00081         return [biface for biface in bases if biface not in ifaces ]

Here is the call graph for this function:

Gets all useful informations from an iface

* name
* dotted name
* trimmed doc string
* base interfaces
* methods with signature and trimmed doc string
* attributes with trimemd doc string

Definition at line 82 of file InterfaceTool.py.

00082 
00083     def getInterfaceInformations(self, iface):
00084         """Gets all useful informations from an iface
00085 
00086         * name
00087         * dotted name
00088         * trimmed doc string
00089         * base interfaces
00090         * methods with signature and trimmed doc string
00091         * attributes with trimemd doc string
00092         """
00093         bases = [ base for base in iface.getBases() if base is not Interface ]
00094 
00095         attributes = []
00096         methods = []
00097         for name, desc in iface.namesAndDescriptions():
00098             if IMethod.isImplementedBy(desc):
00099                 methods.append({'signature' : desc.getSignatureString(),
00100                                 'name' : desc.getName(),
00101                                 'doc' : _trim_doc_string(desc.getDoc()),
00102                                })
00103             else:
00104                 attributes.append({'name' : desc.getName(),
00105                                    'doc' : _trim_doc_string(desc.getDoc()),
00106                                   })
00107 
00108         result = {
00109             'name' : iface.getName(),
00110             'dotted_name' : getDottedName(iface),
00111             'doc' : _trim_doc_string(desc.getDoc()),
00112             'bases' : bases,
00113             'base_names' : [getDottedName(iface) for base in bases ],
00114             'attributes' : attributes,
00115             'methods' : methods,
00116             }
00117 
00118         return result

Here is the call graph for this function:

Returns the list of interfaces which are implemented by the object

Definition at line 59 of file InterfaceTool.py.

00059 
00060     def getInterfacesOf(self, object):
00061         """Returns the list of interfaces which are implemented by the object
00062         """
00063         impl = getImplements(object)
00064         if impl:
00065             if type(impl) in (ListType, TupleType):
00066                 result = flattenInterfaces(impl)
00067             else:
00068                 result = (impl, )
00069             return [ iface for iface in result if iface is not Interface ]

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.InterfaceTool.InterfaceTool.namesAndDescriptions (   self,
  dotted_name,
  all = 0 
)
Returns a list of pairs (name, description) for a given
interface

Definition at line 51 of file InterfaceTool.py.

00051 
00052     def namesAndDescriptions(self, dotted_name, all=0):
00053         """ Returns a list of pairs (name, description) for a given
00054         interface"""
00055         iface = resolveInterface(dotted_name)
00056         nd = iface.namesAndDescriptions(all=all)
00057         return [(n, d.getDoc()) for n, d in nd]

Here is the call graph for this function:

def CMFPlone.InterfaceTool.InterfaceTool.objectImplements (   self,
  obj,
  dotted_name 
)
Asserts if an object implements a given interface 

Definition at line 37 of file InterfaceTool.py.

00037 
00038     def objectImplements(self, obj, dotted_name):
00039         """ Asserts if an object implements a given interface """
00040         obj = aq_base(obj)
00041         iface = resolveInterface(dotted_name)
00042         return iface.isImplementedBy(obj)

Here is the call graph for this function:


Member Data Documentation

Initial value:
(PloneBaseTool.__implements__, z2IInterfaceTool,
                      SimpleItem.__implements__, )

Definition at line 27 of file InterfaceTool.py.

string CMFPlone.InterfaceTool.InterfaceTool.id = 'portal_interface' [static]

Definition at line 32 of file InterfaceTool.py.

string CMFPlone.InterfaceTool.InterfaceTool.meta_type = 'Portal Interface Tool' [static]

Definition at line 33 of file InterfaceTool.py.

tuple CMFPlone.InterfaceTool.InterfaceTool.security = ClassSecurityInfo() [static]

Definition at line 34 of file InterfaceTool.py.


The documentation for this class was generated from the following file: