Skip to content

Commit

Permalink
Hacking in an OData scope
Browse files Browse the repository at this point in the history
  • Loading branch information
suhrawardi committed Jun 24, 2020
1 parent 4f06367 commit 476a60c
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion odata/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,21 @@ class EntityBase(object):
def __odata_url__(cls):
# used by Query
if cls.__odata_collection__:
return urljoin(cls.__odata_service__.url, cls.__odata_collection__)
if cls.__odata_scope__:
if callable(getattr(cls, '__odata_scope__', None)):
return urljoin(
cls.__odata_service__.url,
cls.__odata_scope__(),
cls.__odata_collection__
)
else:
return urljoin(
cls.__odata_service__.url,
cls.__odata_scope__,
cls.__odata_collection__
)
else:
return urljoin(cls.__odata_service__.url, cls.__odata_collection__)

def __new__(cls, *args, **kwargs):
i = super(EntityBase, cls).__new__(cls)
Expand Down

0 comments on commit 476a60c

Please sign in to comment.