Comment 1 for bug 125602

Revision history for this message
Andy Altepeter (aaltepet) wrote : in-depth description of the problem

 the set_creation_datetime function used to
called in SilvaObject.manage_afterAdd

Now in Silva2.0, which uses zope3 events, this is placed in an event handler,
SilvaObject.object_moved, and registered on the IObjectMoved event. This
event does get called when an object is added, and it does appear to set the
creationtime.

So, jumping into SilvaObject._set_creation_datetime, I'm getting a
BindingError. Here's the traceback (of course, most relevant at the bottom):

2007-07-12 11:46:40 ERROR Zope.SiteErrorLog
http://cirdan.its.bethel.edu:9180/sr/edit/add_object_submit
Traceback (innermost last):
  Module ZPublisher.Publish, line 119, in publish
  Module ZPublisher.mapply, line 88, in mapply
  Module ZPublisher.Publish, line 42, in call_object
  Module Products.FileSystemSite.FSPythonScript, line 108, in __call__
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.FileSystemSite.FSPythonScript, line 164, in _exec
  Module None, line 4, in add_object_submit
   - <FSPythonScript
at /sr/service_views/Silva/edit/Container/add_object_submit used
for /sr/service_views/Silva/edit/Container/Publication>
   - Line 4
  Module Products.FileSystemSite.FSPythonScript, line 108, in __call__
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.FileSystemSite.FSPythonScript, line 164, in _exec
  Module None, line 51, in add_submit
   - <FSPythonScript at /sr/service_views/Silva/add/add_submit used
for /sr/service_views/SilvaDocument/add/Document>
   - Line 51
  Module Products.FileSystemSite.FSPythonScript, line 108, in __call__
  Module Shared.DC.Scripts.Bindings, line 313, in __call__
  Module Shared.DC.Scripts.Bindings, line 350, in _bindAndExec
  Module Products.FileSystemSite.FSPythonScript, line 164, in _exec
  Module None, line 1, in add_submit_helper
   - <FSPythonScript
at /sr/service_views/SilvaDocument/add/Document/add_submit_helper>
   - Line 1
  Module Products.Silva.zcml.handlers, line 196, in factory_method
  Module OFS.ObjectManager, line 347, in _setObject
  Module zope.event, line 23, in notify
  Module zope.component.event, line 26, in dispatch
  Module zope.component._api, line 130, in subscribers
  Module zope.component.registry, line 290, in subscribers
  Module zope.interface.adapter, line 535, in subscribers
  Module zope.component.event, line 33, in objectEventNotify
  Module zope.component._api, line 130, in subscribers
  Module zope.component.registry, line 290, in subscribers
  Module zope.interface.adapter, line 535, in subscribers
  Module Products.Silva.SilvaObject, line 593, in object_moved
  Module Products.Silva.SilvaObject, line 125, in _set_creation_datetime
  Module Products.SilvaMetadata.MetadataTool, line 148, in getMetadata
BindingError: invalid content type Silva Document for metadata system

For Documents (and prob. all VersionedContent types that use the provided
dynamic content_factories), the object_moved event calls
_set_creation_datetime on the object (a "Silva Document"), which isn't
registered in the metadata system.

SilvaDocumentVersions, however, are registered for metadata. Looking in
SilvaObject.get_creation_datetime, the retrieval of the actual dt is on
object.get_previewable (which for versionedcontent types, returns the
previewable version).

 This event is called when the Document is placed
in it's container, which happens _before_ the version is placed inside the
document.

So, I though: "subcbrive an IObjectMoved event for IVersions", since the
versions of VersionedContent don't implement ISilvaObject.

The object_moved function is now called when the version is added to the
document. However, since IVersions don't implement _set_creation_datetime,
it's still a "no go".