Update method signatures to match signatures of superclasses
Issue: HIC-170
Change-Id: Iaad395237615dde9fb76e78ea619e89d40a8102e
diff --git a/crashreports/models.py b/crashreports/models.py
index 7e33865..fce6976 100644
--- a/crashreports/models.py
+++ b/crashreports/models.py
@@ -113,11 +113,19 @@
self.save()
return ret
- def save(self, *args, **kwargs):
+ def save(
+ self,
+ force_insert=False,
+ force_update=False,
+ using=None,
+ update_fields=None,
+ ):
"""Save the crashreport and set its local ID if it was not set."""
if not self.device_local_id:
self.device_local_id = self.device.get_crashreport_key()
- super(Crashreport, self).save(*args, **kwargs)
+ super(Crashreport, self).save(
+ force_insert, force_update, using, update_fields
+ )
def _get_uuid(self):
"""Return the device UUID."""
@@ -137,11 +145,19 @@
crashreport_local_id = models.PositiveIntegerField(blank=True)
created_at = models.DateTimeField(auto_now_add=True)
- def save(self, *args, **kwargs):
+ def save(
+ self,
+ force_insert=False,
+ force_update=False,
+ using=None,
+ update_fields=None,
+ ):
"""Save the log file and set its local ID if it was not set."""
if not self.crashreport_local_id:
self.crashreport_local_id = self.crashreport.get_logfile_key()
- super(LogFile, self).save(*args, **kwargs)
+ super(LogFile, self).save(
+ force_insert, force_update, using, update_fields
+ )
class HeartBeat(models.Model):
@@ -161,11 +177,19 @@
device_local_id = models.PositiveIntegerField(blank=True)
created_at = models.DateTimeField(auto_now_add=True)
- def save(self, *args, **kwargs):
+ def save(
+ self,
+ force_insert=False,
+ force_update=False,
+ using=None,
+ update_fields=None,
+ ):
"""Save the heartbeat and set its local ID if it was not set."""
if not self.device_local_id:
self.device_local_id = self.device.get_heartbeat_key()
- super(HeartBeat, self).save(*args, **kwargs)
+ super(HeartBeat, self).save(
+ force_insert, force_update, using, update_fields
+ )
def _get_uuid(self):
"""Return the device UUID."""
diff --git a/crashreports/rest_api_crashreports.py b/crashreports/rest_api_crashreports.py
index 8cf051b..78707b9 100644
--- a/crashreports/rest_api_crashreports.py
+++ b/crashreports/rest_api_crashreports.py
@@ -59,7 +59,7 @@
serializer_class = CrashReportSerializer
filter_fields = ("device", "build_fingerprint", "radio_version")
- def dispatch(self, *args, **kwargs):
+ def dispatch(self, request, *args, **kwargs):
"""Dispatch an incoming HTTP request to the right method.
The method is overridden in order to replace the 'device__uuid'
@@ -69,7 +69,9 @@
self.queryset = Crashreport.objects.filter(
device__uuid=kwargs["uuid"]
)
- return generics.ListCreateAPIView.dispatch(self, *args, **kwargs)
+ return generics.ListCreateAPIView.dispatch(
+ self, request, *args, **kwargs
+ )
def perform_create(self, serializer):
"""Create a crash report instance in the database.
diff --git a/crashreports/rest_api_heartbeats.py b/crashreports/rest_api_heartbeats.py
index adc15e4..33936fd 100644
--- a/crashreports/rest_api_heartbeats.py
+++ b/crashreports/rest_api_heartbeats.py
@@ -44,13 +44,13 @@
serializer_class = HeartBeatSerializer
filter_fields = ("device", "build_fingerprint", "radio_version")
- def get(self, *args, **kwargs):
+ def get(self, request, *args, **kwargs):
"""Override device__uuid parameter with uuid."""
if "uuid" in kwargs:
self.queryset = HeartBeat.objects.filter(
device__uuid=kwargs["uuid"]
)
- return generics.ListCreateAPIView.get(self, *args, **kwargs)
+ return generics.ListCreateAPIView.get(self, request, *args, **kwargs)
@method_decorator(