8000 Handle case where attribute not set (#1143) · howinator/python-docs-samples@c5a1160 · GitHub
[go: up one dir, main page]

Skip to content

Commit c5a1160

Browse files
BrandonYJon Wayne Parrott
authored andcommitted
Handle case where attribute not set (GoogleCloudPlatform#1143)
1 parent 954b6fb commit c5a1160

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

storage/cloud-client/notification_polling.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ def summarize(message):
6464
bucket_id = attributes['bucketId']
6565
object_id = attributes['objectId']
6666
generation = attributes['objectGeneration']
67-
overwrote_generation = attributes['overwroteGeneration']
68-
overwritten_by_generation = attributes['overwrittenByGeneration']
6967
description = (
7068
'\tEvent type: {event_type}\n'
7169
'\tBucket ID: {bucket_id}\n'
@@ -76,11 +74,12 @@ def summarize(message):
7674
object_id=object_id,
7775
generation=generation)
7876

79-
if overwrote_generation:
80-
description += '\tOverwrote generation: %s\n' % overwrote_generation
81-
if overwritten_by_generation:
77+
if 'overwroteGeneration' in attributes:
78+
description += '\tOverwrote generation: %s\n' % (
79+
attributes['overwroteGeneration'])
80+
if 'overwrittenByGeneration' in attributes:
8281
description += '\tOverwritten by generation: %s\n' % (
83-
overwritten_by_generation)
82+
attributes['ovewrittenByGeneration'])
8483

8584
payload_format = attributes['payloadFormat']
8685
if payload_format == 'JSON_API_V1':

0 commit comments

Comments
 (0)
0