def upgrade_to_ghost(self, content):
     container = content.get_container()
     if not IGhostFolder.providedBy(container):
         return None
     if container.get_link_status() is not None:
         logger.warning(
             u"Invalid Ghost Folder, not transforming: %s.",
             content_path(content))
         return None
     content_id = content.getId()
     container_haunted = container.get_haunted()
     content_haunted = container_haunted._getOb(content_id, None)
     if not IImage.providedBy(content_haunted):
         logger.warning(
             u"Original found for %s, but is not an image, not transforming it.",
             content_path(content))
         return None
     # Prevent quota system to fail if the image is an old one.
     # XXX Quota will be out of sync after the upgrade.
     if (content.hires_image is not None and
         content.hires_image.meta_type != 'Silva File'):
         content.hires_image = None
     ghost = get_factory(content_haunted)(
                 ghost=content,
                 container=container,
                 auto_delete=True,
                 auto_publish=True).modify(
         content_haunted, content_id).verify()
     logger.info(
         u"Image converted to ghost asset: %s.",
         content_path(content))
     return ghost
 def upgrade_to_ghost(self, content):
     container = content.get_container()
     if not IGhostFolder.providedBy(container):
         return None
     if container.get_link_status() is not None:
         logger.warning(
             u"Invalid Ghost Folder, not transforming: %s.",
             content_path(content))
         return None
     file_id = content.getId()
     container_haunted = container.get_haunted()
     file_haunted = container_haunted._getOb(file_id, None)
     if not IFile.providedBy(file_haunted):
         logger.warning(
             u"Original found for %s, but is not an file, not transforming it.",
             content_path(content))
         return None
     ghost = get_factory(file_haunted)(
                 ghost=content,
                 container=container,
                 auto_delete=True,
                 auto_publish=True).modify(file_haunted, file_id).verify()
     logger.info(
         u"File converted to ghost asset: %s.",
         content_path(content))
     return ghost