Beispiel #1
0
    def __iter__(self):
        for item in self.previous:
            pathkey = self.pathkey(*item.keys())[0]

            if not pathkey:
                yield item; continue

            type_ = item.get(self.flagkey, None)
            newtype = item.get('_type', None)
            if type_ != 'Blog' and newtype != 'Large Plone Folder':
                yield item; continue

            path = item[pathkey]

            obj = self.context.unrestrictedTraverse(path, None)
            if obj is None:         # path doesn't exist
                yield item; continue

            if type_ == 'Blog' and newtype == 'Large Plone Folder':
                # mark as blog
                if not IWeblogEnhanced.providedBy(obj) and \
                    IPossibleWeblog.providedBy(obj):
                    alsoProvides(obj, IWeblogEnhanced)
                    event.notify(WeblogActivationEvent(obj))

            yield item

        # reindex provided interfaces
        catalog = utils.getToolByName(self.context, 'portal_catalog')
        catalog.reindexIndex('object_provides', None)
Beispiel #2
0
    def __call__(self):
        if IWeblogCategory.providedBy(self.context):
            # deactivate blog category
            noLongerProvides(self.context, IWeblogCategory)
            #return to default folder view
            self.context.setLayout('folder_listing')
            msg = 'blog categroy deactivated'
        elif IPossibleWeblog.providedBy(self.context):
            alsoProvides(self.context, IWeblogCategory)
            #set appropriate view for weblog category
            self.context.setLayout('weblogfolder_view')
            msg = 'blog category activated'
        else:
            msg = 'not bloggable'

        IStatusMessage(self.request).addStatusMessage(msg, type='info')
        self.request.response.redirect(self.context.absolute_url())
 def __call__(self):
     if IWeblogEnhanced.providedBy(self.context):
         # deactivate blog
         event.notify(WeblogDeactivationEvent(self.context))
         noLongerProvides(self.context, IWeblogEnhanced)
         msg = 'blog deactivated'
     elif IPossibleWeblog.providedBy(self.context):
         alsoProvides(self.context, IWeblogEnhanced)
         event.notify(WeblogActivationEvent(self.context))
         msg = 'blog activated'
     else:
         msg = 'not bloggable'
     # XXX This should set the status message with something like:
     # from Products.statusmessages.interfaces import IStatusMessage
     # IStatusMessage(self.request).addStatusMessage(msg, type='info')
     url = self.context.absolute_url() + '?portal_status_message=' + msg
     self.request.response.redirect(url)
Beispiel #4
0
 def can_activate(self):
     return IPossibleWeblog.providedBy(self.context) and \
            not IWeblogCategory.providedBy(self.context)
 def can_activate(self):
     return IPossibleWeblog.providedBy(self.context) and \
            not IWeblogEnhanced.providedBy(self.context)