Commit 3ef755d6 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Everything should work now. bt5 upgrade (not yet committed) will be necessaru...

Everything should work now. bt5 upgrade (not yet committed) will be necessaru to benefit from better guard in document_publication_workflow.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13444 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4ea78131
...@@ -199,7 +199,7 @@ class ContributionTool(BaseTool): ...@@ -199,7 +199,7 @@ class ContributionTool(BaseTool):
# Then put the file inside ourselves for a short while # Then put the file inside ourselves for a short while
BaseTool._setObject(self, file_name, ob) BaseTool._setObject(self, file_name, ob)
document = self[file_name] document = BaseTool._getOb(self, file_name)
# Then edit the document contents (so that upload can happen) # Then edit the document contents (so that upload can happen)
document._edit(**kw) document._edit(**kw)
...@@ -209,16 +209,9 @@ class ContributionTool(BaseTool): ...@@ -209,16 +209,9 @@ class ContributionTool(BaseTool):
# Move the document to where it belongs # Move the document to where it belongs
document = self._setObject(file_name, ob, user_login=user_login) document = self._setObject(file_name, ob, user_login=user_login)
document = self._getOb(file_name) # Call _getOb to purge cache
# Time to empty the cache
if hasattr(self, '_v_document_cache'):
if self._v_document_cache.has_key(file_name):
del self._v_document_cache[file_name]
# Reindex it and return the document # Reindex it and return the document
# XXX seems we have to commit now, otherwise it is not reindexed properly later
# dunno why
get_transaction().commit() # XXX-JPS - WHAT IS THIS ?????????????????????
document.reindexObject() document.reindexObject()
return document return document
...@@ -319,7 +312,8 @@ class ContributionTool(BaseTool): ...@@ -319,7 +312,8 @@ class ContributionTool(BaseTool):
document = module[new_id] document = module[new_id]
document.discoverMetadata(file_name=name, user_login=user_login) document.discoverMetadata(file_name=name, user_login=user_login)
# Keep the document close to us # Keep the document close to us - this is only useful for
# file upload from webdav
if not hasattr(self, '_v_document_cache'): if not hasattr(self, '_v_document_cache'):
self._v_document_cache = {} self._v_document_cache = {}
self._v_document_cache[name] = document.getRelativeUrl() self._v_document_cache[name] = document.getRelativeUrl()
...@@ -332,9 +326,12 @@ class ContributionTool(BaseTool): ...@@ -332,9 +326,12 @@ class ContributionTool(BaseTool):
Check for volatile temp object info first Check for volatile temp object info first
and try to find it and try to find it
""" """
# Use the document cache if possible and return result immediately
# this is only useful for webdav
if hasattr(self, '_v_document_cache'): if hasattr(self, '_v_document_cache'):
document_url = self._v_document_cache.get(id, None) document_url = self._v_document_cache.get(id, None)
if document_url is not None: if document_url is not None:
del self._v_document_cache[id]
return self.getPortalObject().unrestrictedTraverse(document_url) return self.getPortalObject().unrestrictedTraverse(document_url)
# Try first to return an object listed bv listDAVObjects # Try first to return an object listed bv listDAVObjects
...@@ -349,21 +346,6 @@ class ContributionTool(BaseTool): ...@@ -349,21 +346,6 @@ class ContributionTool(BaseTool):
else: else:
return BaseTool._getOb(self, id, default=default) return BaseTool._getOb(self, id, default=default)
def _delOb(self, id):
"""
We don't need to delete, since we never set here
"""
if hasattr(self, '_v_document_cache'):
document_url = self._v_document_cache.get(id, None)
if document_url is not None:
document = self.getPortalObject().unrestrictedTraverse(document_url)
if document is not None:
document.getParentValue()._delOb(document.getId())
del self._v_document_cache[id]
return
return BaseTool._delOb(self, id)
def listDAVObjects(self): def listDAVObjects(self):
""" """
Get all contents contributed by the current user. This is Get all contents contributed by the current user. This is
...@@ -391,5 +373,3 @@ class ContributionTool(BaseTool): ...@@ -391,5 +373,3 @@ class ContributionTool(BaseTool):
return wrapper(object_list) return wrapper(object_list)
InitializeClass(ContributionTool) InitializeClass(ContributionTool)
\ No newline at end of file
# vim: filetype=python syntax=python shiftwidth=2
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment