|
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?
On the other side, Is there a way to define a type of content as a subtype of another? I mean, is there any way of inheritance between content types?
Thank you very much.
Best regards, joseluis. JoseLuis de la Rosa
Triviño
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
