Skip to content

is_allowed method for static attributes is not called in async mode

I found, that async is_allowed method with for static attributes is not called, when server runs with in Asyncio GreenMode

from tango import GreenMode
from tango.server import Device, attribute
from tango.test_context import DeviceTestContext

class test_device(Device):
    green_mode = GreenMode.Asyncio

    attr_r = attribute(dtype=str)

    async def read_attr_r(self):
        return "readable"

    async def is_attr_r_allowed(self, req_type):
        print("is_attr_r_allowed")
        return True

if __name__ == "__main__":
    with DeviceTestContext(test_device, process=True) as proxy:
        print(proxy.attr_r)

result in:

Ready to accept request
sys:1: RuntimeWarning: coroutine 'test_device.is_attr_r_allowed' was never awaited