Commit 657c748f authored by Nicolas Delaby's avatar Nicolas Delaby

Follow Interface specification

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27971 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent aa515128
......@@ -63,12 +63,6 @@ def makeSortedTuple(kw):
items.sort()
return tuple(items)
def generateCacheId(**kw):
"""Generate proper cache id based on **kw.
Function inspired from ERP5Type.Cache
"""
return str(makeSortedTuple(kw)).translate(string.maketrans('', ''), """[]()<>'", """)
class SnapshotMixin:
"""
This class provides a generic API to store in the ZODB
......@@ -163,7 +157,7 @@ class ConversionCacheMixin:
"""
"""
self.updateConversionCache()
cache_id = generateCacheId(**kw)
cache_id = self.generateCacheId(**kw)
plugin_list = self._getCacheFactory().getCachePluginList()
#If there is no plugin list return False OR one them is doesn't contain
#cache_id for givent scope, return False
......@@ -180,7 +174,7 @@ class ConversionCacheMixin:
"""
"""
self.updateConversionCache()
cache_id = generateCacheId(**kw)
cache_id = self.generateCacheId(**kw)
cache_factory = self._getCacheFactory()
cache_duration = cache_factory.cache_duration
if data is not None:
......@@ -197,7 +191,7 @@ class ConversionCacheMixin:
"""
"""
self.updateConversionCache()
cache_id = generateCacheId(**kw)
cache_id = self.generateCacheId(**kw)
for cache_plugin in self._getCacheFactory().getCachePluginList():
cache_entry = cache_plugin.get(self.getPath(), DEFAULT_CACHE_SCOPE)
data = cache_entry.getValue().get(cache_id)
......@@ -213,6 +207,12 @@ class ConversionCacheMixin:
return len(self.getConversion(**kw))
return 0
def generateCacheId(self, **kw):
"""Generate proper cache id based on **kw.
Function inspired from ERP5Type.Cache
"""
return str(makeSortedTuple(kw)).translate(string.maketrans('', ''), """[]()<>'", """)
class PermanentURLMixIn(ExtensibleTraversableMixIn):
"""
Provides access to documents through their permanent URL.
......@@ -1199,7 +1199,7 @@ class Document(PermanentURLMixIn, XMLObject, UrlMixIn, ConversionCacheMixin, Sna
# Base format support
security.declareProtected(Permissions.ModifyPortalContent, 'convertToBaseFormat')
def convertToBaseFormat(self):
def convertToBaseFormat(self, **kw):
"""
Converts the content of the document to a base format
which is later used for all conversions. This method
......
......@@ -191,9 +191,9 @@ class IDocument(Interface):
**kw can be various things - e.g. resolution
"""
def generateCacheId(format):
def generateCacheId(**kw):
"""Return string to identify Document in cache pool with
format - reference - version - language
all arguments used to convert the document
"""
def convertToBaseFormat(**kw):
......
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