[IPOL discuss] patch for automatic self.cfg.save()
eml
enric.meinhardt at cmla.ens-cachan.fr
Tue May 24 12:53:53 CEST 2011
In the current demo system, the programmer can store state in the
server via the "self.cfg" dictionary. This dictionary is read
automatically, but must be saved manually using "self.cfg.save()".
This assymetry is disturbing. The attatched patch to the file
"base_app.py" forces the dictionary to be saved automatically. That
way, the dictionary behaves as a global class variable that can be
shared among different function calls in the same session (of course,
only inside functions decorated with "@init_app").
diff --git a/lib/base_app.py b/lib/base_app.py
index 6e13647..a2d7b45 100644
--- a/lib/base_app.py
+++ b/lib/base_app.py
@@ -63,7 +63,9 @@ def init_app(func):
archive.index_add(self.archive_index,
bucket=ar,
path=self.archive_dir)
- return func(self, *args, **kwargs)
+ x = func(self, *args, **kwargs)
+ self.cfg.save()
+ return x
return init_func
More information about the discuss
mailing list