GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: set custom_time on uploads (#374) · cojenco/python-storage@4730888

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • google/cloud/storage
    • blob.py
  • tests/system
    • test_system.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎google/cloud/storage/blob.py‎

Copy file name to clipboardExpand all lines: google/cloud/storage/blob.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
"contentLanguage",
9797
_CONTENT_TYPE_FIELD,
9898
"crc32c",
99+
"customTime",
99100
"md5Hash",
100101
"metadata",
101102
"name",
@@ -1530,6 +1531,7 @@ def _get_writable_metadata(self):
15301531
* ``contentLanguage``
15311532
* ``contentType``
15321533
* ``crc32c``
1534+
* ``customTime``
15331535
* ``md5Hash``
15341536
* ``metadata``
15351537
* ``name``
Collapse file

‎tests/system/test_system.py‎

Copy file name to clipboardExpand all lines: tests/system/test_system.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,6 +1027,19 @@ def test_upload_blob_owner(self):
10271027
owner = same_blob.owner
10281028
self.assertIn(user_email, owner["entity"])
10291029

1030+
def test_upload_blob_custom_time(self):
1031+
blob = self.bucket.blob("CustomTimeBlob")
1032+
file_contents = b"Hello World"
1033+
current_time = datetime.datetime.now()
1034+
blob.custom_time = current_time
1035+
blob.upload_from_string(file_contents)
1036+
self.case_blobs_to_delete.append(blob)
1037+
1038+
same_blob = self.bucket.blob("CustomTimeBlob")
1039+
same_blob.reload(projection="full")
1040+
custom_time = same_blob.custom_time.replace(tzinfo=None)
1041+
self.assertEqual(custom_time, current_time)
1042+
10301043
def test_blob_crc32_md5_hash(self):
10311044
blob = self.bucket.blob("MyBuffer")
10321045
file_contents = b"Hello World"

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.