diff --git a/api/views.py b/api/views.py index 42d130b..44b2ebe 100644 --- a/api/views.py +++ b/api/views.py @@ -111,7 +111,7 @@ class NewSnapshotView(ApiMixing): text = "fail: It is not possible to parse snapshot" return JsonResponse({'status': text}, status=500) - property = SystemProperty.objects.filter( + prop = SystemProperty.objects.filter( uuid=data['uuid'], # TODO this is hardcoded, it should select the user preferred algorithm key="hidalgo1", @@ -119,7 +119,7 @@ class NewSnapshotView(ApiMixing): ).first() - if not property: + if not prop: logger.error("Error: No property for uuid: %s", data["uuid"]) return JsonResponse({'status': 'fail'}, status=500) diff --git a/device/models.py b/device/models.py index aa1a8fc..15624b1 100644 --- a/device/models.py +++ b/device/models.py @@ -74,12 +74,12 @@ class Device: if not self.uuids: self.get_uuids() - properties = UserProperty.objects.filter( + user_properties = UserProperty.objects.filter( uuid__in=self.uuids, owner=self.owner, type=UserProperty.Type.DOCUMENT ) - return properties + return user_properties def get_uuids(self): for a in self.get_properties(): @@ -105,9 +105,9 @@ class Device: properties = self.get_properties() if not properties.count(): return - property = properties.first() + prop = properties.first() - self.last_evidence = Evidence(property.uuid) + self.last_evidence = Evidence(prop.uuid) def is_eraseserver(self): if not self.uuids: @@ -115,13 +115,13 @@ class Device: if not self.uuids: return False - property = UserProperty.objects.filter( + prop = UserProperty.objects.filter( uuid__in=self.uuids, owner=self.owner, type=UserProperty.Type.ERASE_SERVER ).first() - if property: + if prop: return True return False diff --git a/utils/device.py b/utils/device.py index 865aff1..96fa7f8 100644 --- a/utils/device.py +++ b/utils/device.py @@ -80,15 +80,15 @@ def create_property(doc, user, commit=False): 'value': doc['CUSTOMER_ID'], } if commit: - property = SystemProperty.objects.filter( + prop = SystemProperty.objects.filter( uuid=doc["uuid"], owner=user.institution, ) - if property: + if prop: txt = "Warning: Snapshot %s already registered (system property exists)" logger.warning(txt, doc["uuid"]) - return property + return prop return SystemProperty.objects.create(**data)