UploadStatus: Handle exception ZeroDivisionError
This commit is contained in:
parent
05468196e3
commit
96e623ef57
|
|
@ -28,7 +28,10 @@ class UploadStatus(Status):
|
||||||
return self.obj.name
|
return self.obj.name
|
||||||
|
|
||||||
def progress_raw(self):
|
def progress_raw(self):
|
||||||
|
try:
|
||||||
return self.obj.uploaded_bytes / self.__size * 100
|
return self.obj.uploaded_bytes / self.__size * 100
|
||||||
|
except ZeroDivisionError:
|
||||||
|
return 0
|
||||||
|
|
||||||
def progress(self):
|
def progress(self):
|
||||||
return f'{round(self.progress_raw(), 2)}%'
|
return f'{round(self.progress_raw(), 2)}%'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue