Mercurial > libervia-backend
diff sat/memory/memory.py @ 3123:130f9cb6e0ab
core (memory/params): added `extra` argument to filter out params notably in `getParamsUI`:
In some case, it may be desirable for a frontend to not expose some parameters to user
(e.g. it is the case on Android with the `autoconnect_backend` parameter). An new `extra`
parameter has been added to a couple of parameters method for that: it can contain the
`ignore` key with a list of [category, name] of parameters to skip.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 25 Jan 2020 21:08:40 +0100 |
parents | 8b36e5c3f28f |
children | 73b5228715e8 |
line wrap: on
line diff
--- a/sat/memory/memory.py Sat Jan 25 21:08:39 2020 +0100 +++ b/sat/memory/memory.py Sat Jan 25 21:08:40 2020 +0100 @@ -1130,29 +1130,24 @@ name, category, attr, security_limit, profile_key ) - def asyncGetParamsValuesFromCategory( - self, category, security_limit=C.NO_SECURITY_LIMIT, profile_key=C.PROF_KEY_NONE + def _getParamsValuesFromCategory( + self, category, security_limit, app, extra_s, profile_key ): - return self.params.asyncGetParamsValuesFromCategory( - category, security_limit, profile_key + return self.params._getParamsValuesFromCategory( + category, security_limit, app, extra_s, profile_key ) def asyncGetStringParamA( - self, - name, - category, - attr="value", - security_limit=C.NO_SECURITY_LIMIT, - profile_key=C.PROF_KEY_NONE, - ): - return self.params.asyncGetStringParamA( - name, category, attr, security_limit, profile_key - ) + self, name, category, attr="value", security_limit=C.NO_SECURITY_LIMIT, + profile_key=C.PROF_KEY_NONE): - def getParamsUI( - self, security_limit=C.NO_SECURITY_LIMIT, app="", profile_key=C.PROF_KEY_NONE - ): - return self.params.getParamsUI(security_limit, app, profile_key) + profile = self.getProfileName(profile_key) + return defer.ensureDeferred(self.params.asyncGetStringParamA( + name, category, attr, security_limit, profile + )) + + def _getParamsUI(self, security_limit, app, extra_s, profile_key): + return self.params._getParamsUI(security_limit, app, extra_s, profile_key) def getParamsCategories(self): return self.params.getParamsCategories()