Ejemplo n.º 1
0
 def listTypeInfo(self, container=None):
     """
         Return a sequence of instances which implement the
         TypeInformation interface, one for each content
         type registered in the portal.
     """
     rval = []
     for t in self.objectValues():
         # Filter out things that aren't TypeInformation and
         # types for which the user does not have adequate permission.
         if ITypeInformation.providedBy(t):
             rval.append(t)
         elif getattr(aq_base(t), '_isTypeInformation', 0):
             # BBB
             warn(
                 "The '_isTypeInformation' marker attribute is deprecated, "
                 "and will be removed in CMF 2.3.  Please mark the "
                 "instance with the 'ITypeInformation' interface instead.",
                 DeprecationWarning,
                 stacklevel=2)
             rval.append(t)
     # Skip items with no ID:  old signal for "not ready"
     rval = [t for t in rval if t.getId()]
     # check we're allowed to access the type object
     if container is not None:
         rval = [t for t in rval if t.isConstructionAllowed(container)]
     return rval
Ejemplo n.º 2
0
 def listTypeInfo( self, container=None ):
     """
         Return a sequence of instances which implement the
         TypeInformation interface, one for each content
         type registered in the portal.
     """
     rval = []
     for t in self.objectValues():
         # Filter out things that aren't TypeInformation and
         # types for which the user does not have adequate permission.
         if ITypeInformation.providedBy(t):
             rval.append(t)
         elif getattr(aq_base(t), '_isTypeInformation', 0):
             # BBB
             warn("The '_isTypeInformation' marker attribute is deprecated, "
                  "and will be removed in CMF 2.3.  Please mark the "
                  "instance with the 'ITypeInformation' interface instead.",
                  DeprecationWarning, stacklevel=2)
             rval.append(t)
     # Skip items with no ID:  old signal for "not ready"
     rval = [t for t in rval if t.getId()]
     # check we're allowed to access the type object
     if container is not None:
         rval = [t for t in rval if t.isConstructionAllowed(container)]
     return rval
Ejemplo n.º 3
0
 def getTypeInfo(self, contentType):
     """
         Return an instance which implements the
         TypeInformation interface, corresponding to
         the specified 'contentType'.  If contentType is actually
         an object, rather than a string, attempt to look up
         the appropriate type info using its portal_type.
     """
     if not isinstance(contentType, basestring):
         if hasattr(aq_base(contentType), 'getPortalTypeName'):
             contentType = contentType.getPortalTypeName()
             if contentType is None:
                 return None
         else:
             return None
     ob = getattr(self, contentType, None)
     if ITypeInformation.providedBy(ob):
         return ob
     if getattr(aq_base(ob), '_isTypeInformation', 0):
         # BBB
         warn(
             "The '_isTypeInformation' marker attribute is deprecated, "
             "and will be removed in CMF 2.3.  Please mark the instance "
             "with the 'ITypeInformation' interface instead.",
             DeprecationWarning,
             stacklevel=2)
         return ob
     else:
         return None
Ejemplo n.º 4
0
 def getTypeInfo( self, contentType ):
     """
         Return an instance which implements the
         TypeInformation interface, corresponding to
         the specified 'contentType'.  If contentType is actually
         an object, rather than a string, attempt to look up
         the appropriate type info using its portal_type.
     """
     if not isinstance(contentType, basestring):
         if hasattr(aq_base(contentType), 'getPortalTypeName'):
             contentType = contentType.getPortalTypeName()
             if contentType is None:
                 return None
         else:
             return None
     ob = getattr( self, contentType, None )
     if ITypeInformation.providedBy(ob):
         return ob
     if getattr(aq_base(ob), '_isTypeInformation', 0):
         # BBB
         warn("The '_isTypeInformation' marker attribute is deprecated, "
              "and will be removed in CMF 2.3.  Please mark the instance "
              "with the 'ITypeInformation' interface instead.",
              DeprecationWarning, stacklevel=2)
         return ob
     else:
         return None