Skip to content

Commit

Permalink
creates spatial view api identifier helper method to distinguish from…
Browse files Browse the repository at this point in the history
… flug param in API methods re #10704
  • Loading branch information
whatisgalen committed Mar 26, 2024
1 parent cac12de commit bbb7cda
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arches/app/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,11 @@ def get(self, request, identifier=None):
# spatialview_geometrynodeid = request.get("geometrynodeid", None)
spatialview = None

if identifier:
if self.identifier_is_uuid(identifier):
spatialview_id = identifier
else:
spatialview_slug = identifier
# permission check
permitted_nodegroupids = [nodegroup.pk for nodegroup in get_nodegroups_by_perm(request.user, "models.read_nodegroup")]
spatialviews_dict = {str(sv.geometrynode.pk): sv for sv in models.SpatialView.objects.all()}
Expand Down Expand Up @@ -1740,6 +1745,12 @@ def attribute_nodes_are_valid(self, geom_node=models.Node, attribute_nodeids=[])

return are_valid


def identifier_is_uuid(self, identifier):
uuid_pattern = re.compile(settings.UUID_REGEX, re.IGNORECASE)
return uuid_pattern.match(identifier)


@method_decorator(group_required("Application Administrator"))
def post(self, request, identifier=None):
lang = None
Expand Down

0 comments on commit bbb7cda

Please sign in to comment.