[Nuxeo-tickets] [Nuxeo Repository] #1642: Allow comments when there is diferent types of workspaces or sections.

Nuxeo Repository trac at nuxeo.com
Mon May 8 15:48:08 CEST 2006


#1642: Allow comments when there is diferent types of workspaces or sections.
-------------------------+--------------------------------------------------
 Reporter:  tracguest    |       Owner:  trac     
     Type:  enhancement  |      Status:  new      
 Priority:  P2           |   Milestone:  CPS 3.4.1
Component:  CPSForum     |     Version:  3.4.0    
 Severity:  normal       |    Keywords:           
-------------------------+--------------------------------------------------
 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 is
 "WorkspaceCustomized".

 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
 sectionTypes = ['Section'] ## It's necessary to diferenciate which of the
 parentTypes are sections.
 }}}

 and modify the function 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
 }}}

 and in the getForum4Comments method modify this lines (the comment below
 is from the original code):

 {{{
  # we should create a Workspace if parent folder is a workspace
  # or a Section if parent folder is a section
  if parent_folder.portal_type in sectionTypes:
     folder_type = 'Section'
  else:
     folder_type = 'Workspace'
 }}}

 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?

 Thank you very much.

-- 
Ticket URL: <http://svn.nuxeo.org/trac/pub/ticket/1642>
Nuxeo Repository <http://www.cps-project.org/>
Nuxeo Repository


More information about the Nuxeo-tickets mailing list
More information about CPS: CPS project - CVS - API

Hosting: Nuxeo: Zope service provider


This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.