def manage_pasteObjects(self, cp):
     """ merge another conversation """
     try:
         op, mdatas = _cb_decode(cp)
     except Exception:
         raise CopyError("Invalid content")
     if op == 0:
         raise ValueError('Not allowed to copy content into conversation')
     if op != 1:
         raise ValueError("Invalid operation of content")
     obj = self.unrestrictedTraverse(mdatas[0])
     if IConversation.providedBy(obj):
         if obj.getParentNode() != self.getParentNode():
             raise ValueError("Invalid parent of content")
         forum = obj.getForum()
         obj_id = obj.getId()
         o_list = obj.objectValues()
         oblist = [Moniker(o1).dump() for o1 in o_list]
         cp = (1, oblist)
         cp = _cb_encode(cp)
         CopyContainer.manage_pasteObjects(self, cp)
         forum.manage_delObjects([obj_id])
     elif IComment.providedBy(obj):
         return CopyContainer.manage_pasteObjects(self, cp)
     else:
         raise ValueError('Invalid type of content')
def publish_script(self, sci):
    """Publish the conversation along with comment"""
    object = sci.object

    wftool = sci.getPortal().portal_workflow

    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                if wftool.getInfoFor(parent,'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'publish')
            except Exception:
                pass
def autopublish_script(self, sci):
    """Publish the conversation along with the comment"""
    object = sci.object

    wftool = sci.getPortal().portal_workflow

    # Try to make sure that conversation and contained messages are in sync
    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                if wftool.getInfoFor(parent,'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'publish')
            except:
                pass
Beispiel #4
0
def autopublish_script(self, sci):
    """Publish the conversation along with the comment"""
    object = sci.object

    wftool = sci.getPortal().portal_workflow

    # Try to make sure that conversation and contained messages are in sync
    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                if wftool.getInfoFor(parent, 'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'publish')
            except ConflictError:
                raise
            except Exception:
                pass
def reject_script(self, sci):
    """Reject conversation along with comment"""
    # Dispatch to more easily customizable methods
    object = sci.object
    # We don't have notifyPublished method anymore
    #object.notifyRetracted()

    wftool = sci.getPortal().portal_workflow

    # Try to make sure that conversation and contained messages are in sync
    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                 if wftool.getInfoFor(parent,'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'reject')
            except Exception:
                pass
def publish_script(self, sci):
    """Publish the conversation along with comment"""
    object = sci.object

    wftool = sci.getPortal().portal_workflow

    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                if wftool.getInfoFor(parent,'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'publish')
            except ConflictError:
                raise
            except Exception:
                pass
            #Reindex conversation to update num_comments index
            parent.reindexObject(idxs=('num_comments',))
Beispiel #7
0
def publish_script(self, sci):
    """Publish the conversation along with comment"""
    object = sci.object

    wftool = sci.getPortal().portal_workflow

    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                if wftool.getInfoFor(parent, 'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'publish')
            except ConflictError:
                raise
            except Exception:
                pass
            # Reindex conversation to update num_comments index
            parent.reindexObject(idxs=('num_comments',))
Beispiel #8
0
def reject_script(self, sci):
    """Reject conversation along with comment"""
    # Dispatch to more easily customizable methods
    object = sci.object
    # We don't have notifyPublished method anymore
    # object.notifyRetracted()

    wftool = sci.getPortal().portal_workflow

    # Try to make sure that conversation and contained messages are in sync
    if IComment.providedBy(object):
        parent = aq_parent(aq_inner(object))
        if IConversation.providedBy(parent):
            try:
                if wftool.getInfoFor(parent, 'review_state', None) in (sci.old_state.getId(), 'pending'):
                    wftool.doActionFor(parent, 'reject')
            except ConflictError:
                raise
            except Exception:
                pass