Mercurial > libervia-backend
comparison src/memory/memory.py @ 642:e07a03d52321
core: fix for methods signature
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 08 Sep 2013 15:00:15 +0200 |
parents | 49587e170f53 |
children | 262d9d9ad27a |
comparison
equal
deleted
inserted
replaced
641:49587e170f53 | 642:e07a03d52321 |
---|---|
31 from sat.memory.persistent import PersistentDict | 31 from sat.memory.persistent import PersistentDict |
32 from sat.core import exceptions | 32 from sat.core import exceptions |
33 | 33 |
34 SAVEFILE_PARAM_XML = "/param" # xml parameters template | 34 SAVEFILE_PARAM_XML = "/param" # xml parameters template |
35 SAVEFILE_DATABASE = "/sat.db" | 35 SAVEFILE_DATABASE = "/sat.db" |
36 | 36 NO_SECURITY_LIMIT = -1 |
37 | 37 |
38 class Params(object): | 38 class Params(object): |
39 """This class manage parameters with xml""" | 39 """This class manage parameters with xml""" |
40 ### TODO: add desciption in params | 40 ### TODO: add desciption in params |
41 | 41 |
375 return cache[(category, name)] | 375 return cache[(category, name)] |
376 | 376 |
377 def __constructProfileXml(self, security_limit, profile): | 377 def __constructProfileXml(self, security_limit, profile): |
378 """Construct xml for asked profile, filling values when needed | 378 """Construct xml for asked profile, filling values when needed |
379 /!\ as noticed in doc, don't forget to unlink the minidom.Document | 379 /!\ as noticed in doc, don't forget to unlink the minidom.Document |
380 @security_limit: -1 to return all the params. Otherwise sole the | 380 @security_limit: NO_SECURITY_LIMIT (-1) to return all the params. |
381 params which have a security level defined *and* lower or equal to | 381 Otherwise sole the params which have a security level defined *and* |
382 the specified value are returned. | 382 lower or equal to the specified value are returned. |
383 @param profile: profile name (not key !) | 383 @param profile: profile name (not key !) |
384 @return: a deferred that fire a minidom.Document of the profile xml (cf warning above) | 384 @return: a deferred that fire a minidom.Document of the profile xml (cf warning above) |
385 """ | 385 """ |
386 | 386 |
387 def constructProfile(ignore, profile_cache): | 387 def constructProfile(ignore, profile_cache): |
543 name = cat.getAttribute("name") | 543 name = cat.getAttribute("name") |
544 if name not in categories: | 544 if name not in categories: |
545 categories.append(cat.getAttribute("name")) | 545 categories.append(cat.getAttribute("name")) |
546 return categories | 546 return categories |
547 | 547 |
548 def setParam(self, name, value, category, security_limit=-1, profile_key='@NONE@'): | 548 def setParam(self, name, value, category, security_limit=NO_SECURITY_LIMIT, profile_key='@NONE@'): |
549 """Set a parameter, return None if the parameter is not in param xml""" | 549 """Set a parameter, return None if the parameter is not in param xml""" |
550 #TODO: use different behaviour depending of the data type (e.g. password encrypted) | 550 #TODO: use different behaviour depending of the data type (e.g. password encrypted) |
551 if profile_key != "@NONE@": | 551 if profile_key != "@NONE@": |
552 profile = self.getProfileName(profile_key) | 552 profile = self.getProfileName(profile_key) |
553 if not profile: | 553 if not profile: |
918 return self.params.asyncGetParamA(name, category, attr, profile_key) | 918 return self.params.asyncGetParamA(name, category, attr, profile_key) |
919 | 919 |
920 def asyncGetStringParamA(self, name, category, attr="value", profile_key='@NONE@'): | 920 def asyncGetStringParamA(self, name, category, attr="value", profile_key='@NONE@'): |
921 return self.params.asyncGetStringParamA(name, category, attr, profile_key) | 921 return self.params.asyncGetStringParamA(name, category, attr, profile_key) |
922 | 922 |
923 def getParamsUI(self, security_limit, profile_key): | 923 def getParamsUI(self, security_limit=NO_SECURITY_LIMIT, profile_key='@NONE@'): |
924 return self.params.getParamsUI(security_limit, profile_key) | 924 return self.params.getParamsUI(security_limit, profile_key) |
925 | 925 |
926 def getParams(self, security_limit, profile_key): | 926 def getParams(self, security_limit=NO_SECURITY_LIMIT, profile_key='@NONE@'): |
927 return self.params.getParams(security_limit, profile_key) | 927 return self.params.getParams(security_limit, profile_key) |
928 | 928 |
929 def getParamsForCategory(self, category, security_limit, profile_key): | 929 def getParamsForCategory(self, category, security_limit=NO_SECURITY_LIMIT, profile_key='@NONE@'): |
930 return self.params.getParamsForCategory(category, security_limit, profile_key) | 930 return self.params.getParamsForCategory(category, security_limit, profile_key) |
931 | 931 |
932 def getParamsCategories(self): | 932 def getParamsCategories(self): |
933 return self.params.getParamsCategories() | 933 return self.params.getParamsCategories() |
934 | 934 |
935 def setParam(self, name, value, category, security_limit, profile_key): | 935 def setParam(self, name, value, category, security_limit=NO_SECURITY_LIMIT, profile_key='@NONE@'): |
936 return self.params.setParam(name, value, category, security_limit, profile_key) | 936 return self.params.setParam(name, value, category, security_limit, profile_key) |
937 | 937 |
938 def importParams(self, xml): | 938 def importParams(self, xml): |
939 return self.params.importParams(xml) | 939 return self.params.importParams(xml) |
940 | 940 |