Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAgustin Zubiaga <aguz@sugarlabs.org>2013-11-22 16:17:38 (GMT)
committer Agustin Zubiaga <aguz@sugarlabs.org>2013-11-22 16:17:38 (GMT)
commit12876a702d92c82434051d8311df0aa944f3b8b9 (patch)
treecaf7a302617a8d8418a1e66004f2e2008048ce2a
parent0422a11b5d8ee4a40f57eeaae793c41f42da47eb (diff)
Adding save_data function, to let the user override it
-rw-r--r--simpleactivity.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/simpleactivity.py b/simpleactivity.py
index e5315f3..46e1181 100644
--- a/simpleactivity.py
+++ b/simpleactivity.py
@@ -216,7 +216,13 @@ class SimpleActivity(activity.Activity):
return file_path
+ def save_data(self):
+ """Override this function, in order to save whatever in self.data,
+ this mean that sugar is call the write_file method"""
+ return
+
def write_file(self, file_name):
+ self.save_data()
if self.data is not None and self.data != {}:
try:
wfile = open(file_name, 'w')
@@ -231,3 +237,4 @@ class SimpleActivity(activity.Activity):
self.emit('data-loaded')
finally:
rfile.close()
+