dabo Commit
Revision 4724
Date: 2008-11-27 15:19:33 -0800 (Thu, 27 Nov 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4724
Changed:
U trunk/dabo/biz/RemoteBizobj.py
Log:
Refactored the code so that the cache directory is only created when needed.
Diff:
Modified: trunk/dabo/biz/RemoteBizobj.py
===================================================================
--- trunk/dabo/biz/RemoteBizobj.py 2008-11-27 21:02:02 UTC (rev 4723)
+++ trunk/dabo/biz/RemoteBizobj.py 2008-11-27 23:19:33 UTC (rev 4724)
@@ -11,13 +11,13 @@
cacheDir = os.path.join(os.getcwd(), "cache")
-if not os.path.exists(cacheDir):
- os.makedirs(cacheDir)
-else:
- # Clean up old files?
- pass
+def _createCacheDir():
+ if not os.path.exists(cacheDir):
+ os.makedirs(cacheDir)
+
+
class RemoteBizobj(dBizobj):
def _beforeInit(self):
return super(RemoteBizobj, self)._beforeInit()
@@ -48,6 +48,7 @@
biz.DataSource = ds
biz.hashval = hashval
+ _createCacheDir()
pth = os.path.join(cacheDir, hashval)
if os.path.exists(pth):
f = file(pth)
@@ -86,6 +87,7 @@
"""Store data info to the cache for the next time the same
bizobj
is needed.
"""
+ _createCacheDir()
pth = os.path.join(cacheDir, hashval)
f = file(pth, "w")
pd = {}
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]