Ticket #1636 (closed enhancement: invalid)

Opened 3 years ago

Last modified 2 years ago

To allow .cps_discussions in other types of folders not only in Sections or Workspaces

Reported by: joseluis.rosa@iavante.es Assigned to: jldelarosa
Priority: P2 Milestone: CPS 3.5.0
Component: CPSForum Version: 3.4.0
Severity: normal Keywords:
Cc:

Description

I've found this snippet in CommentTool?.py inside CPSForum product:

def getParentFolder(proxy):
                """Returns 'Section' or 'Workspace' parent folder."""
                parent = proxy.aq_inner.aq_parent
                while parent:
                    if hasattr(parent, 'portal_type') and \
                           (parent.portal_type == 'Section' or
                            parent.portal_type == 'Workspace'):
                        return parent
                    parent = parent.aq_inner.aq_parent
                return proxy.aq_inner.aq_parent

I had some problem with this as I have a new type of folder which type information id is "WorkspaceCustomized?". In fact, the problem is that when a user tries to add a comment to a document hosted in a WorkspaceCustomized? (where the user has permissions to write), the code above moves to the first instance of "Workspace" (where by chance the user has no permissions to write).

What I propose to improve this code is to add a new attribute to the class, let's say:

parentTypes = ['Section', 'Workspace',] ## This would be the initial value for a CPSDefault Site

and modify the procedure as this:

def getParentFolder(proxy):
                """Returns parent folder."""
                parent = proxy.aq_inner.aq_parent
                while parent:
                    if hasattr(parent, 'portal_type') and (parent.portal_type in parentTypes):
                        return parent
                    parent = parent.aq_inner.aq_parent
                return proxy.aq_inner.aq_parent

I implemented this for my own site, and I thought it would be useful for any site. Is this possible to apply it to the original code?

Even this type information identifiers could be managed from ZMI in portal_discussions, what do you think?

Thanks.

Change History

05/06/06 18:25:06 changed by fguillaume

  • version changed from 3.4.1 to 3.4.0.

05/19/06 17:21:51 changed by sfermigier

  • milestone changed from CPS 3.4.1 to CPS 3.4.2.

10/04/06 10:57:37 changed by jldelarosa

  • owner changed from trac to jldelarosa.

06/25/07 09:10:58 changed by jrosa

  • status changed from new to closed.
  • resolution set to invalid.

I have tested this in my own instance and it seems a change too complicated as CPS is designed to work with this two types of folders. It deserves to think more about if this change is needed.