[Zope] WebDAV Metadata
HolgerSchmidt
HolgerSchmidt <hs@keppler-it.de>
Thu, 3 Jul 2003 15:07:23 +0200
Wednesday, 2003-07-11 21:10 Dieter Maurer wrote:
DM> Holger Schmidt wrote at 2003-6-11 17:36 +0200:
DM> > ...
DM> > Using WebDAV you are able to attach Metadata to a document by calling
DM> > PROPPATCH and you can get this Metadata by calling PROPFIND ...
DM> >
DM> > Zope saves these Properties in the ZODB.
DM> >
DM> > Properties are handled by OFS.PropertyManager.PropertyManager and for
DM> > the Presentation OFS.PropertySheets.PropertySheet is used ...
DM> > ---
DM> >
DM> > I think it should be possible to "redirect" this Metadata, so a
DM> > PROPPATCH would save the Metadata to 'MY' MySQL-DB and a PROPFIND
DM> > would get it from 'MY' MySQL-DB ...
DM> >
DM> > Has anybody ever done something like this before?
DM> I did something like this but for general attributes
DM> (not WebDAV properties).
DM> A word of warning:
DM> You get lots of nasty problems when you distribute attribute
DM> storage between ZODB and something external.
DM> Moving and copying must be treated carefully.
DM> Export/Import is likely to break.
DM> Undo and Versions will bring your system in an inconsistent state.
DM> Apart from that, it is not too difficult:
DM> Attribute access can be handled by letting "__getattr__"
DM> fetch the attributes from the database on demand.
hmm ... this works as far as I do not change any attributes via WebDAV
or the "Zope Management Interface" ...
If I change these attributes every later WebDAV-Request returns the
values i changed the attributes to even if i return some other value in
my __getattr__-Method:
def __getattr__(self, name):
# if one of my attributes return "MyValue :)"
if (name[:5]=='LIRA_':
return "MyValue :)"
# none of my attributes => use __getattr__ of PropertyManager
return PropertyManager.__getattr__(self, name)
# def __getattr__
is only __getattr__ called when webdav returns properties or are there
even some more functions that are touched by this operation?
DM> For modification, the "PropertyManager" methods can
DM> be overridden to update the values in the database
DM> (be careful, if you delay update until transaction
DM> commit (for efficiency). It may be too late then to
DM> register the DA.).
Holger