dabo Commit
Revision 3538
Date: 2007-10-21 07:27:06 -0700 (Sun, 21 Oct 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3538
Changed:
U trunk/dabo/biz/dBizobj.py
Log:
Refactored to make the code more efficient when running inside of an
application, which is the vast majority of cases.
Diff:
Modified: trunk/dabo/biz/dBizobj.py
===================================================================
--- trunk/dabo/biz/dBizobj.py 2007-10-21 05:36:01 UTC (rev 3537)
+++ trunk/dabo/biz/dBizobj.py 2007-10-21 14:27:06 UTC (rev 3538)
@@ -268,14 +268,13 @@
If the token is granted, then this bizobj has the ability
to begin and
end transactions.
"""
- app = self.Application
- if not app:
- # No Application in play: fake it.
+ try:
+ return self.Application.getTransactionToken(self)
+ except AttributeError:
if not hasattr(dabo, "_bizTransactionToken"):
dabo._bizTransactionToken = self
return True
return False
- return app.getTransactionToken(self)
def _releaseTransactionToken(self):
@@ -284,10 +283,9 @@
Once this is done, other bizobjs can receive the token to begin
and
end transactions.
"""
- app = self.Application
- if app:
- app.releaseTransactionToken(self)
- else:
+ try:
+ self.Application.releaseTransactionToken(self)
+ except AttributeError:
# No Application in play: fake it.
if hasattr(dabo, "_bizTransactionToken") and
dabo._bizTransactionToken == self:
del(dabo._bizTransactionToken)
_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]