configurables must contain only settable properties

+ bug fix in TCLRequestHandler (decoding error)
+ cosmetic changes

Change-Id: I824e06f1acf975bb59c3312bb97fdfca23e6c975
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21826
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
zolliker 2019-11-22 09:05:15 +01:00
parent 6af440c971
commit c0c926d9d7
3 changed files with 9 additions and 7 deletions

View File

@ -194,10 +194,12 @@ class ModuleMeta(PropertyMeta):
res = {}
# collect info about properties
for pn, pv in cls.properties.items():
if pv.settable:
res[pn] = pv
# collect info about parameters and their properties
for param, pobj in cls.accessibles.items():
res[param] = {}
for pn, pv in pobj.getProperties().items():
if pv.settable:
res[param][pn] = pv
return res

View File

@ -200,8 +200,7 @@ class Module(HasProperties, metaclass=ModuleMeta):
raise
# raise ConfigError('Module %s: config parameter %r:\n%r' %
# (self.name, k, e))
# note: this will call write_* methods which will
# write to the hardware, if possible!
# note: this will NOT call write_* methods!
if k != 'value':
setattr(self, k, v)
cfgdict.pop(k)

View File

@ -122,7 +122,8 @@ class TCPRequestHandler(socketserver.BaseRequestHandler):
try:
msg = decode_msg(origin)
except Exception as err:
msg = origin.split(' ',3)
# we have to decode 'origin' here. utf-8 and ascii may lead to encoding errors
msg = origin.decode('latin-1').split(' ', 3)
result = (ERRORPREFIX + msg[0], msg[1], ['InternalError', str(err),
{'exception': formatException(),
'traceback': formatExtendedStack()}])