Skip to content

Commit 863a6e3

Browse files
authored
Merge pull request #43 from octue/fix-allow-overwrite-failure
FIX: Prevent permissions mode map from using None values from property
2 parents b0ca6be + 7f5ecc8 commit 863a6e3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

django_gcp/storage/fields.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ def __init__(
107107
**kwargs,
108108
):
109109
self._versioning_enabled = None
110-
self._existing_value = None
111110
self._temporary_path = None
112111
self._primary_key_set_explicitly = "primary_key" in kwargs
113112
self._choices_set_explicitly = "choices" in kwargs
@@ -274,12 +273,13 @@ def on_commit_valid():
274273
)
275274

276275
else:
277-
# TODO Remove this once we've enough experience in production
276+
# Raise unknown edge cases rather than failing silently
278277
raise ValueError(
279278
f"Unable to determine field state for {self._get_fieldname(model_instance)}. The most likely cause of this doing an operation (like migration) without setting GCP_STORAGE_OVERRIDE_BLOBFIELD_VALUE=True. Otherwise, please contact the django_gcp developers and describe what you're doing along with this exception stacktrace. Value was: {json.dumps(value)}"
280279
)
281280

282281
# Cache DB values in the instance so you can reuse it without multiple DB queries
282+
# pylint: disable-next=protected-access
283283
model_instance._state.fields_cache[self.attname] = new_value
284284

285285
return new_value
@@ -390,6 +390,7 @@ def versioning_enabled(self):
390390
"""True if object versioning is enabled on the bucket configured for this field"""
391391
if self._versioning_enabled is None:
392392
self._versioning_enabled = bool(self.storage.bucket.versioning_enabled)
393+
return self._versioning_enabled
393394

394395
def _check_ingress_to(self):
395396
if isinstance(self.ingress_to, str) and self.ingress_to.startswith("/"):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-gcp"
3-
version = "0.10.2"
3+
version = "0.10.3"
44
description = "Utilities to run Django on Google Cloud Platform"
55
authors = ["Tom Clark"]
66
license = "MIT"

0 commit comments

Comments
 (0)