From 01ce6d80e7fc0d1be5a931f3df24af7c2f486c95 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Fri, 16 Aug 2019 10:18:53 -0500 Subject: [PATCH] Ensure discord_uuid and mc_uuid are strings in get_player() --- GeoffreyApp/api/commands.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GeoffreyApp/api/commands.py b/GeoffreyApp/api/commands.py index a4fc82c..f630d25 100644 --- a/GeoffreyApp/api/commands.py +++ b/GeoffreyApp/api/commands.py @@ -49,6 +49,9 @@ def parse_help(func): def get_player(discord_uuid=None, mc_uuid=None): try: + discord_uuid = str(discord_uuid) + mc_uuid = str(mc_uuid) + if discord_uuid is not None: player = Player.objects.get(discord_uuid__iexact=discord_uuid) elif mc_uuid is not None: @@ -291,7 +294,8 @@ def delete(name, discord_uuid=None, mc_uuid=None): owner = get_player(discord_uuid, mc_uuid) try: - Location.objects.get(name__iexact=name, owner=owner).delete() + if Location.objects.get(name__iexact=name, owner=owner).delete() == 0: + raise Location.DoesNotExist except Location.DoesNotExist: raise LocationLookUpError