예제 #1
0
def canBeHaunted(to_be_haunted):
    if IGhost.providedBy(to_be_haunted):
        return 0
    if (IContainer.providedBy(to_be_haunted) or
            IContent.providedBy(to_be_haunted)):
        return 1
    return 0

#END
예제 #2
0
 def get_link_status(self, content=None):
     """return an error code if this version of the ghost is broken.
     returning None means the ghost is Ok.
     """
     if content is None:
         content = self.get_haunted_unrestricted(check=0)
     if self._content_path is None:
         return self.LINK_EMPTY
     if content is None:
         return self.LINK_VOID
     if IContainer.providedBy(content):
         return self.LINK_FOLDER
     if not IContent.providedBy(content):
         return self.LINK_NO_CONTENT
     if IGhost.providedBy(content):
         return self.LINK_GHOST
     return self.LINK_OK