Here's a warning about using the edit() method of CPSDocuments (that is, nearly all types of documents in CPS).

When you do:

  doc = proxy.getEditableContent()
  doc.edit(...)

You want the document to be properly reindexed. But remember, since CPS 3.2 it's the proxy itself that we reindex, not the object in the repository. So you have to do:

  doc.edit(proxy=proxy, ...)

If you don't, then bad things will happen:
- the proxy will not be reindexed, which may not be a problem if it's done later or not important, - the doc will be indexed, which is bad, and very visible now that the doc "appears" to be under the proxy. So you get fake objects in the catalog, like .../workspaces/members/admin/mondoc/1235471__0001. This breaks code like _reindexObjectSecurity.

I think I'll have to patch the catalog to avoid indexing such objects, but it's harder than in the previous case where we had 'portal_repository' in the path.

Note, if you suspect you may be cataloging docs instead of proxies by mistake, you can add this code to the method catalogObject in lib/ python/Products/ZCatalog/Catalog.py:

    def catalogObject(self, object, uid, threshold=None, idxs=None,
                      update_metadata=1):
        """..."""
        if uid.endswith('__0001'):
            print 'cataloging', uid
            import traceback
            from zExceptions.ExceptionFormatter import format_exception
            traceback.format_exception = format_exception
            traceback.print_stack()
        ...

This will give you the callers and you can fix them.

Florent

--
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]


_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to