Back to index

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

List of all members.

Public Member Functions

def getPhysicalPath
def __ac_local_roles__
def has_local_roles
def get_local_roles_for_userid
def get_valid_userids
def valid_roles
def validate_roles
def userdefined_roles
def owner_info
def getOwner
def userCanTakeOwnership
def allowedContentTypes
def __getitem__
def manage_renameObject

Static Public Attributes

string portal_type = 'TempFolder'
int isPrincipiaFolderish = 0

Detailed Description

Definition at line 34 of file FactoryTool.py.


Member Function Documentation

__ac_local_roles__ needs to be handled carefully.
Zope's and GRUF's User.getRolesInContext both walk up the
acquisition hierarchy using aq_parent(aq_inner(obj)) when
they gather local roles, and this process will result in
their walking from TempFolder to portal_factory to the portal root.

Definition at line 53 of file FactoryTool.py.

00053 
00054     def __ac_local_roles__(self):
00055         """__ac_local_roles__ needs to be handled carefully.
00056         Zope's and GRUF's User.getRolesInContext both walk up the
00057         acquisition hierarchy using aq_parent(aq_inner(obj)) when
00058         they gather local roles, and this process will result in
00059         their walking from TempFolder to portal_factory to the portal root."""
00060         object = aq_parent(aq_parent(self))
00061         local_roles = {}
00062         while 1:
00063             # Get local roles for this user
00064             lr = getattr(object, '__ac_local_roles__', None)
00065             if lr:
00066                 if callable(lr):
00067                     lr=lr()
00068                 lr = lr or {}
00069                 for k, v in lr.items():
00070                     if not local_roles.has_key(k):
00071                         local_roles[k] = []
00072                     for role in v:
00073                         if not role in local_roles[k]:
00074                             local_roles[k].append(role)
00075 
00076             # Check if local role has to be acquired (PLIP 16)
00077             if getattr(object, '__ac_local_roles_block__', None):
00078                 # Ok, we have to stop there, as lr. blocking is enabled
00079                 break
00080 
00081             # Prepare next iteration
00082             inner = getattr(object, 'aq_inner', object)
00083             parent = getattr(inner, 'aq_parent', None)
00084             if parent is not None:
00085                 object = parent
00086                 continue
00087             if hasattr(object, 'im_self'):
00088                 object=object.im_self
00089                 object=getattr(object, 'aq_inner', object)
00090                 continue
00091             break
00092         return local_roles

Here is the caller graph for this function:

Definition at line 129 of file FactoryTool.py.

00129 
00130     def __getitem__(self, id):
00131         # Zope's inner acquisition chain for objects returned by __getitem__ will be
00132         # portal -> portal_factory -> temporary_folder -> object
00133         # What we really want is for the inner acquisition chain to be
00134         # intended_parent_folder -> portal_factory -> temporary_folder -> object
00135         # So we need to rewrap...
00136         portal_factory = aq_parent(self)
00137         intended_parent = aq_parent(portal_factory)
00138 
00139         # If the intended parent has an object with the given id, just do a passthrough
00140         if hasattr(intended_parent, id):
00141             return getattr(intended_parent, id)
00142 
00143         # rewrap portal_factory
00144         portal_factory = aq_base(portal_factory).__of__(intended_parent)
00145         # rewrap self
00146         temp_folder = aq_base(self).__of__(portal_factory)
00147 
00148         if id in self.objectIds():
00149             return (aq_base(self._getOb(id)).__of__(temp_folder)).__of__(intended_parent)
00150         else:
00151             type_name = self.getId()
00152             try:
00153                 self.invokeFactory(id=id, type_name=type_name)
00154             except ConflictError:
00155                 raise
00156             except:
00157                 # some errors from invokeFactory (AttributeError, maybe others)
00158                 # get swallowed -- dump the exception to the log to make sure
00159                 # developers can see what's going on
00160                 log_exc(severity=logging.DEBUG)
00161                 raise
00162             obj = self._getOb(id)
00163             
00164             # keep obj out of the catalog
00165             obj.unindexObject()
00166 
00167             # additionally keep it out of Archetypes UID and refs catalogs
00168             if base_hasattr(obj, '_uncatalogUID'):
00169                 obj._uncatalogUID(obj)
00170             if base_hasattr(obj, '_uncatalogRefs'):
00171                 obj._uncatalogRefs(obj)
00172 
00173             return (aq_base(obj).__of__(temp_folder)).__of__(intended_parent)

Here is the caller graph for this function:

Definition at line 126 of file FactoryTool.py.

00126 
00127     def allowedContentTypes(self):
00128         return aq_parent(aq_parent(self)).allowedContentTypes()

Definition at line 96 of file FactoryTool.py.

00096 
00097     def get_local_roles_for_userid(self, userid):
00098         return tuple(self.__ac_local_roles__().get(userid, []))

Here is the call graph for this function:

Definition at line 99 of file FactoryTool.py.

00099 
00100     def get_valid_userids(self):
00101         return aq_parent(aq_parent(self)).get_valid_userids()

def CMFPlone.FactoryTool.TempFolder.getOwner (   self,
  info = 0,
  aq_get = aq_get,
  UnownableOwner = Owned.UnownableOwner,
  getSecurityManager = getSecurityManager 
)

Definition at line 119 of file FactoryTool.py.

00119 
00120                  ):
00121         return aq_parent(aq_parent(self)).getOwner(info, aq_get, UnownableOwner, getSecurityManager)

Here is the caller graph for this function:

Returns a path (an immutable sequence of strings)
that can be used to access this object again
later, for example in a copy/paste operation.  getPhysicalRoot()
and getPhysicalPath() are designed to operate together.

Definition at line 41 of file FactoryTool.py.

00041 
00042     def getPhysicalPath(self):
00043         '''Returns a path (an immutable sequence of strings)
00044         that can be used to access this object again
00045         later, for example in a copy/paste operation.  getPhysicalRoot()
00046         and getPhysicalPath() are designed to operate together.
00047         '''
00048         portal_factory = aq_parent(aq_inner(self))
00049         path = aq_parent(portal_factory).getPhysicalPath() + \
00050             (portal_factory.getId(), self.getId(),)
00051         return path

Here is the caller graph for this function:

Definition at line 93 of file FactoryTool.py.

00093 
00094     def has_local_roles(self):
00095         return len(self.__ac_local_roles__())

Here is the call graph for this function:

def CMFPlone.FactoryTool.TempFolder.manage_renameObject (   self,
  id,
  new_id,
  REQUEST = None 
)

Definition at line 175 of file FactoryTool.py.

00175 
00176     def manage_renameObject(self, id, new_id, REQUEST=None):
00177         pass
00178 
00179 
# ##############################################################################

Here is the caller graph for this function:

Definition at line 112 of file FactoryTool.py.

00112 
00113     def owner_info(self):
00114         return aq_parent(aq_parent(self)).owner_info()

Here is the call graph for this function:

Definition at line 122 of file FactoryTool.py.

00122 
00123     def userCanTakeOwnership(self):
00124         return aq_parent(aq_parent(self)).userCanTakeOwnership()

Definition at line 108 of file FactoryTool.py.

00108 
00109     def userdefined_roles(self):
00110         return aq_parent(aq_parent(self)).userdefined_roles()

Here is the caller graph for this function:

Definition at line 102 of file FactoryTool.py.

00102 
00103     def valid_roles(self):
00104         return aq_parent(aq_parent(self)).valid_roles()

Here is the caller graph for this function:

Definition at line 105 of file FactoryTool.py.

00105 
00106     def validate_roles(self, roles):
00107         return aq_parent(aq_parent(self)).validate_roles(roles)


Member Data Documentation

Definition at line 36 of file FactoryTool.py.

Definition at line 35 of file FactoryTool.py.


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