[Erp5-report] r41907 nicolas - in /erp5/trunk/products/ERP5/Document: Document.py File.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Dec 31 11:09:37 CET 2010
Author: nicolas
Date: Fri Dec 31 11:09:36 2010
New Revision: 41907
URL: http://svn.erp5.org?rev=41907&view=rev
Log:
* Move getFilename to File, because Document class is deprecated.
* Declare security on Accessor
* Honour default argument if equals to None
Modified:
erp5/trunk/products/ERP5/Document/Document.py
erp5/trunk/products/ERP5/Document/File.py
Modified: erp5/trunk/products/ERP5/Document/Document.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Document.py?rev=41907&r1=41906&r2=41907&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Document.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Document.py [utf8] Fri Dec 31 11:09:36 2010
@@ -788,11 +788,3 @@ class Document(DocumentExtensibleTravers
return container.isIndexContent(self)
return False
- # backward compatibility
- def getFilename(self, default=None):
- if self.hasFilename():
- return self._baseGetFilename(default)
- elif self.hasSourceReference():
- return self._baseGetSourceReference(default)
- else:
- return default
Modified: erp5/trunk/products/ERP5/Document/File.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/File.py?rev=41907&r1=41906&r2=41907&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/File.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/File.py [utf8] Fri Dec 31 11:09:36 2010
@@ -47,6 +47,8 @@ def _unpackData(data):
"""
return str(data)
+_MARKER = object()
+
class File(Document, CMFFile):
"""
A File can contain raw data which can be uploaded and downloaded.
@@ -273,6 +275,23 @@ class File(Document, CMFFile):
return 'text/plain', ''
raise NotImplementedError
+ # backward compatibility
+ security.declareProtected(Permissions.AccessContentsInformation, 'getFilename')
+ def getFilename(self, default=_MARKER):
+ """Fallback on getSourceReference as it was used
+ before to store filename property
+ """
+ if self.hasFilename():
+ if default is _MARKER:
+ return self._baseGetFilename()
+ else:
+ return self._baseGetFilename(default)
+ else:
+ if default is _MARKER:
+ return self._baseGetSourceReference()
+ else:
+ return self._baseGetSourceReference(default)
+
# CMFFile also brings the IContentishInterface on CMF 2.2, remove it.
removeIContentishInterface(File)
More information about the Erp5-report
mailing list