[CPS-devel] Refactoring in CommentTool.py

JoseLuis de la Rosa Triviño joseluis.rosa at iavantefundacion.com
Mon May 8 16:04:16 CEST 2006


The ticket is http://svn.nuxeo.org/trac/pub/ticket/1642 

Thanks.

JoseLuis de la Rosa Triviño 
Becario Área de Sistemas de Información 
FUNDACIÓN IAVANTE 
joseluis.rosa at iavantefundacion.com 
Tel. 951 015 300 


Este correo electrónico y, en su caso, cualquier fichero anexo, contiene información confidencial exclusivamente dirigida a su(s) destinatario(s). Toda copia o divulgación deberá ser autorizada por IAVANTE.

This e-mail and any attachments are confidential and exclusively directed to its adressee(s). Any copy or distribution will have to be authorized by IAVANTE.



-----Mensaje original-----
De: Florent Guillaume [mailto:fg at nuxeo.com] 
Enviado el: viernes, 05 de mayo de 2006 20:21
Para: JoseLuis de la Rosa Triviño
Asunto: Re: [CPS-devel] Refactoring in CommentTool.py

For things like this, please also add an enhancement ticket in Trac.

Florent

On 5 May 2006, at 18:56, JoseLuis de la Rosa Triviño wrote:

> Hello all!
>
>
> 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
>
>
> 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?
>
>
> I already proposed this some time ago, but I think this email was  
> not read. When we moved from 3.3.8 to 3.4.0 we had the same  
> problem, that's why I send this again.
>
>
> Thank you very much.
>
>
> JoseLuis de la Rosa Triviño
> Becario Área de Sistemas de Información
> FUNDACIÓN IAVANTE
> joseluis.rosa at iavantefundacion.com
> Tel. 951 015 300
>
>
> Este correo electrónico y, en su caso, cualquier fichero anexo,  
> contiene información confidencial exclusivamente dirigida a su(s)  
> destinatario(s). Toda copia o divulgación deberá ser autorizada por  
> IAVANTE.
>
> This e-mail and any attachments are confidential and exclusively  
> directed to its adressee(s). Any copy or distribution will have to  
> be authorized by IAVANTE.
>
>
> _______________________________________________
> cps-devel mailing list
> http://lists.nuxeo.com/mailman/listinfo/cps-devel

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com





More information about the cps-devel 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.