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
[EMAIL PROTECTED]
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

Reply via email to