Ticket #1191 (closed defect: fixed)

Opened 14 years ago

Last modified 14 years ago

Publish form after unpublish something.

Reported by: joseluis.rosa@… Owned by: trac
Priority: P1 Milestone: CPS 3.4.0
Component: CPSDefault Version: 3.3.8
Severity: normal Keywords:
Cc:

Description

This is the use case I tried on a new CPS Default Site using CPS 3.3.8:

1.- Publish any document into any section. 2.- Go to the published document in the section 3.- Unpublish the document.

The document is unpublished correctly but after doing this, "content_submit_form" is showed again with the portal_status_message "You must choose at least one section for publication. Publication aborded !".

I think that the problem is in this snippet as this is done no matter what the workflow_action is:

[...]
# No section has been specified
# XXX We should get a list in here
if REQUEST and len(REQUEST.form) < 3:
    psm = 'psm_you_must_select_sections_for_publishing'
[...]

what I did to fix it is to move the code to the next else statement:

[...]
else:
   # No section has been specified
   # XXX We should get a list in here
    if REQUEST and len(REQUEST.form) < 3:
       psm = 'psm_you_must_select_sections_for_publishing'
    else:
      # publishing: copy and initalize proxy into one or more sections
      allowed_transitions = wftool.getAllowedPublishingTransitions(context)
      for transition in allowed_transitions:
          rpaths = kw.get(transition)
          if rpaths:
              if same_type(rpaths, ''):
                  rpaths = (rpaths,)
              for rpath in rpaths:
                  wftool.doActionFor(context, workflow_action,
                                   dest_container=rpath,
                                   initial_transition=transition,
                                   comment=comments)
[...]

The whole code of content_status_modify.py is:

# $Id: content_status_modify.py 27699 2005-09-29 02:11:59Z janguenot $
"""
FIXME: add docstring.
"""

wftool = context.portal_workflow

if REQUEST is not None:
    kw.update(REQUEST.form)

comments = kw.get('comments', '')

folder = context.aq_parent
id = context.getId()
url = None

psm = 'psm_status_changed'

if workflow_action != 'copy_submit':
    # accept, reject, ...
    if comments:
        del kw['comments']
    kw['comment'] = comments
    res = wftool.doActionFor(context, workflow_action, **kw)
    if same_type(res, ()):
        if res[0] == 'ObjectMoved':
            rpath = res[1]
            url = context.portal_url()
            if not url.endswith('/'):
                url += '/'
            url += rpath
else:
   # No section has been specified
   # XXX We should get a list in here
    if REQUEST and len(REQUEST.form) < 3:
       psm = 'psm_you_must_select_sections_for_publishing'
    else:
      # publishing: copy and initalize proxy into one or more sections
      allowed_transitions = wftool.getAllowedPublishingTransitions(context)
      for transition in allowed_transitions:
          rpaths = kw.get(transition)
          if rpaths:
              if same_type(rpaths, ''):
                  rpaths = (rpaths,)
              for rpath in rpaths:
                  wftool.doActionFor(context, workflow_action,
                                   dest_container=rpath,
                                   initial_transition=transition,
                                   comment=comments)

if REQUEST is not None:
    # If the object has been deleted, we can't redirect to it.
    if url is None:
        if id in folder.objectIds():
            url = context.absolute_url()
        else:
            url = folder.absolute_url()

    if psm == 'psm_you_must_select_sections_for_publishing':
        redirect_url = '%s/content_submit_form?%s' % (
            url, 'portal_status_message=%s'%psm)
    else:
        redirect_url = '%s/?%s' % (url, 'portal_status_message=%s'%psm)
    REQUEST.RESPONSE.redirect(redirect_url)

Change History

comment:1 Changed 14 years ago by fguillaume

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from CPS 3.3.8 to CPS 3.4.0

Already fixed in the trunk.

Note: See TracTickets for help on using tickets.