Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/addons/oncewrapper.py
diff options
context:
space:
mode:
authorSimon Poirier <simpoir@gmail.com>2009-10-28 06:15:15 (GMT)
committer Simon Poirier <simpoir@gmail.com>2009-10-28 06:15:15 (GMT)
commit53af01c95abe622c0490b43c12439a04aa449509 (patch)
tree6e7ca498415f8e20874c1eaf7b2c19458218eeb3 /addons/oncewrapper.py
parentd5e7b4d380dfa9b979071b862e67d29ec127c542 (diff)
addon test extension to check interface contraints
Diffstat (limited to 'addons/oncewrapper.py')
-rw-r--r--addons/oncewrapper.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/addons/oncewrapper.py b/addons/oncewrapper.py
index 5db3b60..9f339a4 100644
--- a/addons/oncewrapper.py
+++ b/addons/oncewrapper.py
@@ -26,17 +26,16 @@ class OnceWrapper(Action):
action = TAddonProperty()
- def __init__(self, action):
+ def __init__(self, action=None):
Action.__init__(self)
- self._called = False
- self._need_undo = False
- self.action = action
+ if action:
+ self.action = action
def do(self):
"""
Do the action only on the first time
"""
- if not self._called:
+ if not hasattr(self, '_called'):
self._called = True
self.action.do()
self._need_undo = True
@@ -45,9 +44,9 @@ class OnceWrapper(Action):
"""
Undo the action if it's been done
"""
- if self._need_undo:
+ if hasattr(self, '_need_undo'):
self.action.undo()
- self._need_undo = False
+ del self._need_undo
__action__ = {