fixed bugs from syntax migration
- a new wrapper for a read function is not only to be created when the a new read function is in the class dict, but also when it inherited, but not yet wrapped - a proxy class must not call checkProperties
This commit is contained in:
parent
04692bd1aa
commit
1760881f56
@ -89,16 +89,17 @@ class HasAccessibles(HasProperties):
|
||||
if isinstance(pobj, Command):
|
||||
# nothing to do for now
|
||||
continue
|
||||
rfunc = cls.__dict__.get('read_' + pname, None)
|
||||
rfunc = getattr(cls, 'read_' + pname, None)
|
||||
rfunc_handler = pobj.handler.get_read_func(cls, pname) if pobj.handler else None
|
||||
not_wrapped = getattr(rfunc, '__wrapped__', False) is False
|
||||
if rfunc_handler:
|
||||
if rfunc:
|
||||
if rfunc and not_wrapped:
|
||||
raise ProgrammingError("parameter '%s' can not have a handler "
|
||||
"and read_%s" % (pname, pname))
|
||||
rfunc = rfunc_handler
|
||||
|
||||
# create wrapper except when read function is already wrapped
|
||||
if rfunc is None or getattr(rfunc, '__wrapped__', False) is False:
|
||||
if rfunc is None or not_wrapped:
|
||||
|
||||
def wrapped_rfunc(self, pname=pname, rfunc=rfunc):
|
||||
if rfunc:
|
||||
@ -126,11 +127,12 @@ class HasAccessibles(HasProperties):
|
||||
|
||||
if not pobj.readonly:
|
||||
wfunc = getattr(cls, 'write_' + pname, None)
|
||||
if wfunc is None: # ignore the handler, if a write function is present
|
||||
not_wrapped = getattr(wfunc, '__wrapped__', False) is False
|
||||
if wfunc is None or not_wrapped: # ignore the handler, if a write function is present
|
||||
wfunc = pobj.handler.get_write_func(pname) if pobj.handler else None
|
||||
|
||||
# create wrapper except when write function is already wrapped
|
||||
if wfunc is None or getattr(wfunc, '__wrapped__', False) is False:
|
||||
if wfunc is None or not_wrapped:
|
||||
|
||||
def wrapped_wfunc(self, value, pname=pname, wfunc=wfunc):
|
||||
self.log.debug("check validity of %s = %r" % (pname, value))
|
||||
|
@ -122,6 +122,8 @@ class ProxyModule(HasIodev, Module):
|
||||
self.announceUpdate(pname, None, readerror)
|
||||
self.announceUpdate('status', newstatus)
|
||||
|
||||
def checkProperties(self):
|
||||
pass # skip
|
||||
|
||||
class ProxyReadable(ProxyModule, Readable):
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user