Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ietf/doc/migrations/0031_storedobject_blank_not_null.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright The IETF Trust 2026, All Rights Reserved

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("doc", "0030_alter_dochistory_title_alter_document_title"),
]

operations = [
migrations.AlterField(
model_name="storedobject",
name="doc_name",
field=models.CharField(blank=True, default="", max_length=255),
preserve_default=False,
),
migrations.AlterField(
model_name="storedobject",
name="doc_rev",
field=models.CharField(blank=True, default="", max_length=16),
preserve_default=False,
),
]
12 changes: 6 additions & 6 deletions ietf/doc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,8 @@ def store_bytes(
name: str,
content: bytes,
allow_overwrite: bool = False,
doc_name: Optional[str] = None,
doc_rev: Optional[str] = None
doc_name: str = "",
doc_rev: str = "",
) -> None:
return utils_store_bytes(self.type_id, name, content, allow_overwrite, self.name, self.rev)

Expand All @@ -826,8 +826,8 @@ def store_file(
name: str,
file: Union[File, BufferedReader],
allow_overwrite: bool = False,
doc_name: Optional[str] = None,
doc_rev: Optional[str] = None
doc_name: str = "",
doc_rev: str = "",
) -> None:
return utils_store_file(self.type_id, name, file, allow_overwrite, self.name, self.rev)

Expand Down Expand Up @@ -1751,8 +1751,8 @@ class StoredObject(models.Model):
null=False,
help_text="Last instant object was modified. May not be the same as the storage's modified value for the instance. It will hold mtime for objects imported from older disk storage unless they've actually been overwritten more recently"
)
doc_name = models.CharField(max_length=255, null=True, blank=True)
doc_rev = models.CharField(max_length=16, null=True, blank=True)
doc_name = models.CharField(max_length=255, null=False, blank=True)
doc_rev = models.CharField(max_length=16, null=False, blank=True)
deleted = models.DateTimeField(null=True)

class Meta:
Expand Down
6 changes: 3 additions & 3 deletions ietf/doc/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

class StoredObjectFile(MetadataFile):
"""Django storage File object that represents a StoredObject"""
def __init__(self, file, name, mtime=None, content_type="", store=None, doc_name=None, doc_rev=None):
def __init__(self, file, name, mtime=None, content_type="", store=None, doc_name="", doc_rev=""):
super().__init__(
file=file,
name=name,
Expand Down Expand Up @@ -131,12 +131,12 @@ def _save_stored_object(self, name, content) -> StoredObject:
doc_name=getattr(
content,
"doc_name", # Note that these are assumed to be invariant
None, # should be blank?
"",
),
doc_rev=getattr(
content,
"doc_rev", # for a given name
None, # should be blank?
"",
),
),
)
Expand Down
12 changes: 6 additions & 6 deletions ietf/doc/storage_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ def store_file(
name: str,
file: Union[File, BufferedReader],
allow_overwrite: bool = False,
doc_name: Optional[str] = None,
doc_rev: Optional[str] = None,
doc_name: str = "",
doc_rev: str = "",
content_type: str="",
mtime: Optional[datetime.datetime]=None,
) -> None:
Expand Down Expand Up @@ -106,8 +106,8 @@ def store_bytes(
name: str,
content: bytes,
allow_overwrite: bool = False,
doc_name: Optional[str] = None,
doc_rev: Optional[str] = None,
doc_name: str = "",
doc_rev: str = "",
content_type: str = "",
mtime: Optional[datetime.datetime] = None,
) -> None:
Expand Down Expand Up @@ -136,8 +136,8 @@ def store_str(
name: str,
content: str,
allow_overwrite: bool = False,
doc_name: Optional[str] = None,
doc_rev: Optional[str] = None,
doc_name: str = "",
doc_rev: str = "",
content_type: str = "",
mtime: Optional[datetime.datetime] = None,
) -> None:
Expand Down
4 changes: 2 additions & 2 deletions ietf/sync/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def load_rfcs_into_blobdb(numbers: list[int]):
content=bytes,
allow_overwrite=False, # Intentionally not allowing overwrite.
doc_name=f"rfc{num}",
doc_rev=None,
doc_rev="",
# Not setting content_type
mtime=datetime.datetime.fromtimestamp(
mtime, tz=datetime.UTC
Expand All @@ -65,7 +65,7 @@ def load_rfcs_into_blobdb(numbers: list[int]):
content=bytes,
allow_overwrite=False, # Intentionally not allowing overwrite.
doc_name=f"rfc{num}",
doc_rev=None,
doc_rev="",
# Not setting content_type
mtime=datetime.datetime.fromtimestamp(mtime, tz=datetime.UTC),
)
Expand Down
Loading