When trying to extend FeatureLayerResource:
from restle.actions import Action
from restle.fields import TextField
from restle.resources import Resource
class ParentResource(Resource):
text_field = TextField()
query_field = Action(...)
class ChildResourceOne(ParentResource):
pass # text_field present, query_field unavailable
class ChildResourceTwo(ParentResource):
# Class definition fails because query_field is removed
query_field = ParentResource.query_field
There is no way to inherit query_field in the usual manner of Python class inheritance.
Current workaround: put Action(...) into a constant that can be referenced in both the parent and the child classes:
from restle.actions import Action
from restle.fields import TextField
from restle.resources import Resource
QUERY_ACTION = Action(...)
class ParentResource(Resource):
text_field = TextField()
query_field = QUERY_ACTION
class ChildResourceOne(ParentResource):
query_field = QUERY_ACTION
When trying to extend FeatureLayerResource:
There is no way to inherit
query_fieldin the usual manner of Python class inheritance.Current workaround: put
Action(...)into a constant that can be referenced in both the parent and the child classes: