Back to index

plone3  3.1.7
Classes | Functions | Variables
ATContentTypes.lib.constraintypes Namespace Reference

Classes

class  ConstrainTypesMixin

Functions

def parentPortalTypeEqual

Variables

string __author__ = 'Jens Klein <jens.klein@jensquadrat.de>'
string __docformat__ = 'plaintext'
int ACQUIRE = 1
int DISABLED = 0
int ENABLED = 1
tuple enableDisplayList
tuple ConstrainTypesMixinSchema

Function Documentation

Compares the portal type of obj to the portal type of its parent

Return values:
    None - no acquisition context / parent available
    False - unequal
    True - equal

Definition at line 130 of file constraintypes.py.

00130 
00131 def parentPortalTypeEqual(obj):
00132     """Compares the portal type of obj to the portal type of its parent
00133     
00134     Return values:
00135         None - no acquisition context / parent available
00136         False - unequal
00137         True - equal
00138     """
00139     portal_factory = getToolByName(obj, 'portal_factory', None)
00140     if portal_factory is not None and portal_factory.isTemporary(obj):
00141         # created by portal_factory
00142         parent = aq_parent(aq_parent(aq_parent(aq_inner(obj))))
00143     else:
00144         parent = aq_parent(aq_inner(obj))
00145 
00146     if parent is None:
00147         return None # no context
00148     parent_type = getattr(parent.aq_explicit, 'portal_type', None)
00149     obj_type = getattr(obj.aq_explicit, 'portal_type')
00150     if obj_type and parent_type == obj_type:
00151         return True
00152     return False
00153 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

string ATContentTypes.lib.constraintypes.__author__ = 'Jens Klein <jens.klein@jensquadrat.de>'

Definition at line 23 of file constraintypes.py.

Definition at line 24 of file constraintypes.py.

Definition at line 53 of file constraintypes.py.

Definition at line 68 of file constraintypes.py.

Definition at line 54 of file constraintypes.py.

Definition at line 55 of file constraintypes.py.

Initial value:
00001 IntDisplayList((
00002     (ACQUIRE,  _(u'constraintypes_acquire_label', default=u'Use parent folder settings')),
00003     (DISABLED, _(u'constraintypes_disable_label', default=u'Use portal default')),
00004     (ENABLED,  _(u'constraintypes_enable_label', default=u'Select manually')),
00005     ))

Definition at line 62 of file constraintypes.py.