[Zope-CVS] CVS: Products/FileCacheManager - FileCacheManager.py:1.12
Jens Vagelpohl
jens at dataflake.org
Sun Aug 15 12:34:45 EDT 2004
Update of /cvs-repository/Products/FileCacheManager
In directory cvs.zope.org:/tmp/cvs-serv2358
Modified Files:
FileCacheManager.py
Log Message:
- Using a TAL expression to create file names works for simple expressions
=== Products/FileCacheManager/FileCacheManager.py 1.11 => 1.12 ===
--- Products/FileCacheManager/FileCacheManager.py:1.11 Sun Aug 15 07:43:53 2004
+++ Products/FileCacheManager/FileCacheManager.py Sun Aug 15 12:34:45 2004
@@ -55,7 +55,7 @@
""" Compute a filename based on an MD5 hash: doesn't preserve
human-readable path, but otherwise makes life much easier """
if self._naming_expr is not None:
- expr_context = self._getExprContext(self, ob)
+ expr_context = self.getExprContext(ob)
munged = self._naming_expr(expr_context)
fname = os.path.join(self._dir, munged)
else:
@@ -67,13 +67,15 @@
def getExprContext(self, ob=None):
""" Create a context for evaluating the TAL naming expression """
- return { 'user' : getSecurityManager.getAuthenticatedUser()
- , 'request' : getattr(ob, 'REQUEST', None)
- , 'modules' : SecureModuleImporter
- , 'object' : ob
- , 'object_url' : ob.absolute_url()
- , 'nothing' : None
- }
+ data = { 'user' : getSecurityManager().getUser()
+ , 'request' : getattr(ob, 'REQUEST', None)
+ , 'modules' : SecureModuleImporter
+ , 'object' : ob
+ , 'object_url' : ob.absolute_url()
+ , 'nothing' : None
+ }
+
+ return getEngine().getContext(data)
def setNamingExpression(self, naming_expression=''):
""" Set a new file naming expression """
More information about the Zope-CVS
mailing list