Ensure discord_uuid and mc_uuid are strings in get_player()
parent
3ab7bcf5aa
commit
01ce6d80e7
|
@ -49,6 +49,9 @@ def parse_help(func):
|
||||||
|
|
||||||
def get_player(discord_uuid=None, mc_uuid=None):
|
def get_player(discord_uuid=None, mc_uuid=None):
|
||||||
try:
|
try:
|
||||||
|
discord_uuid = str(discord_uuid)
|
||||||
|
mc_uuid = str(mc_uuid)
|
||||||
|
|
||||||
if discord_uuid is not None:
|
if discord_uuid is not None:
|
||||||
player = Player.objects.get(discord_uuid__iexact=discord_uuid)
|
player = Player.objects.get(discord_uuid__iexact=discord_uuid)
|
||||||
elif mc_uuid is not None:
|
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)
|
owner = get_player(discord_uuid, mc_uuid)
|
||||||
try:
|
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:
|
except Location.DoesNotExist:
|
||||||
raise LocationLookUpError
|
raise LocationLookUpError
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue