예제 #1
0
 def unpublish(self, guid):
     '''
     Implementation for @see: IContentPublisherService.unpublish
     '''
     # Test delete document
     Item.objects(guid=guid).delete(safe=True)
     return True
예제 #2
0
 def unpublish(self, guid):
     '''
     Implementation for @see: IContentPublisherService.unpublish
     '''
     # Test delete document
     Item.objects(guid=guid).delete(safe=True)
     return True
예제 #3
0
    def publish(self, guid):
        '''
        Implementation for @see: IContentPublisherService.publish
        '''
        # Test add document
        myItem = self.itemService.getById(guid)
        assert isinstance(myItem, PackageItem)

        item = Item()
        item.guid = myItem.GUId
        item.version = myItem.Version
        item.itemClass = myItem.ItemClass
        item.urgency = myItem.Urgency
        item.headline = myItem.HeadLine
        item.slugline = myItem.SlugLine
        item.byline = myItem.Byline
        item.creditline = myItem.CreditLine
        item.firstCreated = myItem.FirstCreated
        item.versionCreated = myItem.VersionCreated

        q = QItemContent()
        q.item = myItem.GUId
        contents = self.itemContentService.getAll(q=q)
        for c in contents:
            assert isinstance(c, ItemContent)
            content = Content()
            content.contenttype = c.ContentType
            content.content = c.Content
            content.residRef = c.ResidRef
            content.href = c.HRef
            content.size = c.Size
            content.rendition = c.Rendition
            item.contents.append(content)

        self.unpublish(item.guid)
        item.save(safe=True)
        return True
예제 #4
0
    def publish(self, guid):
        '''
        Implementation for @see: IContentPublisherService.publish
        '''
        # Test add document
        myItem = self.itemService.getById(guid)
        assert isinstance(myItem, PackageItem)

        item = Item()
        item.guid = myItem.GUId
        item.version = myItem.Version
        item.itemClass = myItem.ItemClass
        item.urgency = myItem.Urgency
        item.headline = myItem.HeadLine
        item.slugline = myItem.SlugLine
        item.byline = myItem.Byline
        item.creditline = myItem.CreditLine
        item.firstCreated = myItem.FirstCreated
        item.versionCreated = myItem.VersionCreated

        q = QItemContent()
        q.item = myItem.GUId
        contents = self.itemContentService.getAll(q=q)
        for c in contents:
            assert isinstance(c, ItemContent)
            content = Content()
            content.contenttype = c.ContentType
            content.content = c.Content
            content.residRef = c.ResidRef
            content.href = c.HRef
            content.size = c.Size
            content.rendition = c.Rendition
            item.contents.append(content)

        self.unpublish(item.guid)
        item.save(safe=True)
        return True