Back to index

plone3  3.1.7
Classes | Functions | Variables
CMFPlone.InterfaceTool Namespace Reference

Classes

class  InterfaceTool
class  InterfaceFinder

Functions

def resolveInterface
def getDottedName
def _trim_doc_string
def visitBaseInterfaces

Variables

tuple _marker = ('module_finder',)

Function Documentation

def CMFPlone.InterfaceTool._trim_doc_string (   text) [private]
Trims a doc string to make it format
correctly with structured text.

Definition at line 132 of file InterfaceTool.py.

00132 
00133 def _trim_doc_string(text):
00134     """
00135     Trims a doc string to make it format
00136     correctly with structured text.
00137     """
00138     text = text.strip().replace('\r\n', '\n')
00139     lines = text.split('\n')
00140     nlines = [lines[0]]
00141     if len(lines) > 1:
00142         min_indent=None
00143         for line in lines[1:]:
00144             indent=len(line) - len(line.lstrip())
00145             if indent < min_indent or min_indent is None:
00146                 min_indent=indent
00147         for line in lines[1:]:
00148             nlines.append(line[min_indent:])
00149     return '\n'.join(nlines)

Here is the caller graph for this function:

Definition at line 129 of file InterfaceTool.py.

00129 
00130 def getDottedName(iface):
00131     return "%s.%s" % (iface.__module__, iface.__name__)

Here is the caller graph for this function:

Definition at line 119 of file InterfaceTool.py.

00119 
00120 def resolveInterface(dotted_name):
00121     parts = dotted_name.split('.')
00122     m_name = '.'.join(parts[:-1])
00123     k_name = parts[-1]
00124     module = __import__(m_name, globals(), locals(), [k_name])
00125     klass = getattr(module, k_name)
00126     if not issubclass(klass, Interface):
00127         raise ValueError, '%r is not a valid Interface.' % dotted_name
00128     return klass

Here is the caller graph for this function:

def CMFPlone.InterfaceTool.visitBaseInterfaces (   iface,
  lst 
)

Definition at line 150 of file InterfaceTool.py.

00150 
00151 def visitBaseInterfaces(iface, lst):
00152     bases = iface.getBases()
00153     for base in bases:
00154         if base is Interface or base in lst:
00155             return
00156         lst.append(base)
00157         visitBaseInterfaces(iface, lst)

Here is the caller graph for this function:


Variable Documentation

tuple CMFPlone.InterfaceTool._marker = ('module_finder',)

Definition at line 20 of file InterfaceTool.py.