mypy: Amend logic in check_upload_within_quota to avoid None.

This commit is contained in:
neiljp (Neil Pilgrim)
2018-02-19 01:05:49 +00:00
committed by Tim Abbott
parent 435bfb3159
commit 4efb83ee29

View File

@@ -191,10 +191,11 @@ def currently_used_upload_space(realm: Realm) -> int:
return used_space
def check_upload_within_quota(realm: Realm, uploaded_file_size: int) -> None:
if realm.upload_quota_bytes() is None:
upload_quota = realm.upload_quota_bytes()
if upload_quota is None:
return
used_space = currently_used_upload_space(realm)
if (used_space + uploaded_file_size) > realm.upload_quota_bytes():
if (used_space + uploaded_file_size) > upload_quota:
raise RealmUploadQuotaError(_("Upload would exceed your organization's upload quota."))
def get_file_info(request: HttpRequest, user_file: File) -> Tuple[Text, int, Optional[Text]]: