class DenoiseProperty(PropertyView): """Value of integration_time""" schema = fields.Int(required=True, minimum=100, maximum=500) semtype = "LevelProperty" @op.readproperty def get(self): # When a GET request is made, we'll find our attached component my_component = find_component("org.labthings.example.mycomponent") return my_component.integration_time @op.writeproperty def put(self, new_property_value): # Find our attached component my_component = find_component("org.labthings.example.mycomponent") # Apply the new value my_component.integration_time = new_property_value return my_component.integration_time
class TestSchema(Schema): test_regexp = fields.Int(validate=validate.Regexp(r"\d+"))
class Index(ActionView): args = {"integer": fields.Int()} semtype = "ToggleAction" def post(self): return "POST"
class Index(ActionView): schema = fields.Int() response_content_type = "text/plain; charset=us-ascii" def post(self): return "POST"
class Index(PropertyView): schema = fields.Int() def put(self): return "PUT"
class Index(PropertyView): schema = fields.Int(required=True) def get(self): return "GET"