Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Attributes
CMFCore.DynamicType.DynamicType Class Reference

List of all members.

Public Member Functions

def getPortalTypeName
def getTypeInfo
def getActionInfo
def getIcon
def __before_publishing_traverse__

Static Public Attributes

 portal_type = None
tuple security = ClassSecurityInfo()
 icon = getIcon

Private Member Functions

def _setPortalTypeName

Static Private Attributes

 __implements__ = z2IDynamicType
 _getPortalTypeName = getPortalTypeName

Detailed Description

Mixin for portal content that allows the object to take on
a dynamic type property.

Definition at line 31 of file DynamicType.py.


Member Function Documentation

def CMFCore.DynamicType.DynamicType.__before_publishing_traverse__ (   self,
  arg1,
  arg2 = None 
)
Pre-traversal hook.

Definition at line 115 of file DynamicType.py.

00115 
00116     def __before_publishing_traverse__(self, arg1, arg2=None):
00117         """ Pre-traversal hook.
00118         """
00119         # XXX hack around a bug(?) in BeforeTraverse.MultiHook
00120         REQUEST = arg2 or arg1
00121 
00122         if REQUEST['REQUEST_METHOD'] not in ('GET', 'POST'):
00123             return
00124 
00125         stack = REQUEST['TraversalRequestNameStack']
00126         key = stack and stack[-1] or '(Default)'
00127 
00128         # if there's a Zope3-style default view name set and the
00129         # corresponding view exists, take that in favour of the FTI's
00130         # default view
00131         if key == '(Default)':
00132             viewname = queryDefaultViewName(self, REQUEST)
00133             if (viewname and
00134                 queryMultiAdapter((self, REQUEST), name=viewname) is not None):
00135                 stack.append(viewname)
00136                 REQUEST._hacked_path = 1
00137                 return
00138 
00139         ti = self.getTypeInfo()
00140         method_id = ti and ti.queryMethodID(key, context=self)
00141         if method_id:
00142             if key != '(Default)':
00143                 stack.pop()
00144             if method_id != '(Default)':
00145                 stack.append(method_id)
00146             REQUEST._hacked_path = 1
00147 
00148 InitializeClass(DynamicType)

Here is the call graph for this function:

def CMFCore.DynamicType.DynamicType._setPortalTypeName (   self,
  pt 
) [private]
Set the portal type name.

Called by portal_types during construction, records an ID that will be
used later to locate the correct ContentTypeInformation.

Definition at line 45 of file DynamicType.py.

00045 
00046     def _setPortalTypeName(self, pt):
00047         """ Set the portal type name.
00048 
00049         Called by portal_types during construction, records an ID that will be
00050         used later to locate the correct ContentTypeInformation.
00051         """
00052         self.portal_type = pt

def CMFCore.DynamicType.DynamicType.getActionInfo (   self,
  action_chain,
  check_visibility = 0,
  check_condition = 0 
)
Get an Action info mapping specified by a chain of actions.

Definition at line 76 of file DynamicType.py.

00076 
00077                       check_condition=0):
00078         """ Get an Action info mapping specified by a chain of actions.
00079         """
00080         ti = self.getTypeInfo()
00081         if ti:
00082             return ti.getActionInfo(action_chain, self, check_visibility,
00083                                     check_condition)
00084         else:
00085             msg = 'Action "%s" not available for %s' % (
00086                         action_chain, '/'.join(self.getPhysicalPath()))
00087             raise ValueError(msg)

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.DynamicType.DynamicType.getIcon (   self,
  relative_to_portal = 0 
)
Using this method allows the content class
creator to grab icons on the fly instead of using a fixed
attribute on the class.

Definition at line 91 of file DynamicType.py.

00091 
00092     def getIcon(self, relative_to_portal=0):
00093         """
00094         Using this method allows the content class
00095         creator to grab icons on the fly instead of using a fixed
00096         attribute on the class.
00097         """
00098         ti = self.getTypeInfo()
00099         if ti is not None:
00100             icon = quote(ti.getIcon())
00101             if icon:
00102                 if relative_to_portal:
00103                     return icon
00104                 else:
00105                     # Relative to REQUEST['BASEPATH1']
00106                     portal_url = getToolByName( self, 'portal_url' )
00107                     res = portal_url(relative=1) + '/' + icon
00108                     while res[:1] == '/':
00109                         res = res[1:]
00110                     return res
00111         return 'misc_/OFSP/dtmldoc.gif'

Here is the call graph for this function:

Here is the caller graph for this function:

Get the portal type name that can be passed to portal_types.

Definition at line 54 of file DynamicType.py.

00054 
00055     def getPortalTypeName(self):
00056         """ Get the portal type name that can be passed to portal_types.
00057         """
00058         pt = self.portal_type
00059         if callable( pt ):
00060             pt = pt()
00061         return pt

Get the TypeInformation object specified by the portal type.

Definition at line 66 of file DynamicType.py.

00066 
00067     def getTypeInfo(self):
00068         """ Get the TypeInformation object specified by the portal type.
00069         """
00070         tool = getToolByName(self, 'portal_types', None)
00071         if tool is None:
00072             return None
00073         return tool.getTypeInfo(self)  # Can return None.

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

CMFCore.DynamicType.DynamicType.__implements__ = z2IDynamicType [static, private]

Definition at line 39 of file DynamicType.py.

Definition at line 63 of file DynamicType.py.

Definition at line 113 of file DynamicType.py.

Definition at line 41 of file DynamicType.py.

tuple CMFCore.DynamicType.DynamicType.security = ClassSecurityInfo() [static]

Definition at line 43 of file DynamicType.py.


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