Ensure discord_uuid and mc_uuid are strings in get_player()

doc_update
Joey Hines 2019-08-16 10:18:53 -05:00
parent 3ab7bcf5aa
commit 01ce6d80e7
1 changed files with 5 additions and 1 deletions

View File

@ -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