renamed property variable to prop

This commit is contained in:
Thomas Nahuel Rusiecki 2025-01-14 15:14:36 -03:00
parent 8042ca39cb
commit 626d176408
3 changed files with 11 additions and 11 deletions

View file

@ -111,7 +111,7 @@ class NewSnapshotView(ApiMixing):
text = "fail: It is not possible to parse snapshot" text = "fail: It is not possible to parse snapshot"
return JsonResponse({'status': text}, status=500) return JsonResponse({'status': text}, status=500)
property = SystemProperty.objects.filter( prop = SystemProperty.objects.filter(
uuid=data['uuid'], uuid=data['uuid'],
# TODO this is hardcoded, it should select the user preferred algorithm # TODO this is hardcoded, it should select the user preferred algorithm
key="hidalgo1", key="hidalgo1",
@ -119,7 +119,7 @@ class NewSnapshotView(ApiMixing):
).first() ).first()
if not property: if not prop:
logger.error("Error: No property for uuid: %s", data["uuid"]) logger.error("Error: No property for uuid: %s", data["uuid"])
return JsonResponse({'status': 'fail'}, status=500) return JsonResponse({'status': 'fail'}, status=500)

View file

@ -74,12 +74,12 @@ class Device:
if not self.uuids: if not self.uuids:
self.get_uuids() self.get_uuids()
properties = UserProperty.objects.filter( user_properties = UserProperty.objects.filter(
uuid__in=self.uuids, uuid__in=self.uuids,
owner=self.owner, owner=self.owner,
type=UserProperty.Type.DOCUMENT type=UserProperty.Type.DOCUMENT
) )
return properties return user_properties
def get_uuids(self): def get_uuids(self):
for a in self.get_properties(): for a in self.get_properties():
@ -105,9 +105,9 @@ class Device:
properties = self.get_properties() properties = self.get_properties()
if not properties.count(): if not properties.count():
return return
property = properties.first() prop = properties.first()
self.last_evidence = Evidence(property.uuid) self.last_evidence = Evidence(prop.uuid)
def is_eraseserver(self): def is_eraseserver(self):
if not self.uuids: if not self.uuids:
@ -115,13 +115,13 @@ class Device:
if not self.uuids: if not self.uuids:
return False return False
property = UserProperty.objects.filter( prop = UserProperty.objects.filter(
uuid__in=self.uuids, uuid__in=self.uuids,
owner=self.owner, owner=self.owner,
type=UserProperty.Type.ERASE_SERVER type=UserProperty.Type.ERASE_SERVER
).first() ).first()
if property: if prop:
return True return True
return False return False

View file

@ -80,15 +80,15 @@ def create_property(doc, user, commit=False):
'value': doc['CUSTOMER_ID'], 'value': doc['CUSTOMER_ID'],
} }
if commit: if commit:
property = SystemProperty.objects.filter( prop = SystemProperty.objects.filter(
uuid=doc["uuid"], uuid=doc["uuid"],
owner=user.institution, owner=user.institution,
) )
if property: if prop:
txt = "Warning: Snapshot %s already registered (system property exists)" txt = "Warning: Snapshot %s already registered (system property exists)"
logger.warning(txt, doc["uuid"]) logger.warning(txt, doc["uuid"])
return property return prop
return SystemProperty.objects.create(**data) return SystemProperty.objects.create(**data)