コード例 #1
0
ファイル: TypesTool.py プロジェクト: c0ns0le/zenoss-4
 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
コード例 #2
0
ファイル: TypesTool.py プロジェクト: c0ns0le/zenoss-4
 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
コード例 #3
0
ファイル: TypesTool.py プロジェクト: c0ns0le/zenoss-4
 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
コード例 #4
0
ファイル: TypesTool.py プロジェクト: c0ns0le/zenoss-4
 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
コード例 #5
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)
     # 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
コード例 #6
0
ファイル: TypesTool.py プロジェクト: goschtl/zope
 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)
     # 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
コード例 #7
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, six.string_types):
         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
     else:
         return None
コード例 #8
0
ファイル: TypesTool.py プロジェクト: goschtl/zope
 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
     else:
         return None