Hi Raphael. Perhaps a workflow could be a solution.
You could create an uploads folder that all your bib uploads will be
uploaded into. So instead of registering a content_type in the
registry, you can rely on existing type (File type) that is already
happy with WebDAV and create a file workflow In your workflow script
you could test to see that the upload is coming from the specific
upload folder for your bib files and if it meets this condition changes
the type to what you need and execute anything else you need to do,
like put the files where you want (not sure about your specific needs).
If the file is not being uploaded into the specified folder, it would
pass through script without changing the type. I have used this
approach and it has worked fine for me where I change the type and run
some other processes when a file is uploaded using a regular upload or
using WebDAV.
Alternatively, if you are going to add webdav functionality to your
product, I believe this is demonstrated in CMFDefault in file content
type (File.py) that has upload and webdav methods for hints.
Hope this helps.
Regards
David
On Tuesday, June 7, 2005, at 07:17 AM, Raphael Ritz wrote:
Hi,
looks like I don't see the forrest for the trees.
What I want to do:
I have a custom product (CMFBibliography) to handle references
to publications.
Now I want to support FTP/DAV upload of Bibtex files, which may
contain an arbitrary number of references, in the following way:
1. If the target folder is a regular portal folder it should
create a new subfolder of type 'BibliographyFolder' from my
product and in there it should create appropriate entries
for the individual references contained in the bibtex file
(the basic functionality is all there; TTW uploads work as
expected).
2. If the target folder is already a 'BibliographyFolder'
no new folder should be created but the references from the
bibtex file should be created in there right away for references
that aren't there yet or edited for those that already exist.
I know that I can use the content_type_registry to
define that '.bib' uploads should generate BibliographyFolders
but how do I distinguish the two situations sketched above?
Most importantly, I don't really see where to hook into the
framework when it comes to 'PUT' versus 'PUT_factory', probabaly
because I still don't understand the processing chain for uploads
and what's supposed to happen where and when and in which order
(calling PUT from webdav null resource calling the folder's
'PUT_factory' calling the folder's 'PUT' ???).
I do see from comments in the code that uploads of collections
aren't supported per se but it shouldn't be too hard to do
this in special cases like here anyway, shouldn't it?
Any pointers welcome.
Raphael
_______________________________________________
Zope-CMF maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests
_______________________________________________
Zope-CMF maillist - [email protected]
http://mail.zope.org/mailman/listinfo/zope-cmf
See http://collector.zope.org/CMF for bug reports and feature requests