@@ -544,6 +544,19 @@ def cors(self):
544
544
See http://www.w3.org/TR/cors/ and
545
545
https://cloud.google.com/storage/docs/json_api/v1/buckets
546
546
547
+ .. note::
548
+
549
+ The getter for this property returns a list which contains
550
+ *copies* of the bucket's CORS policy mappings. Mutating the list
551
+ or one of its dicts has no effect unless you then re-assign the
552
+ dict via the setter. E.g.:
553
+
554
+ >>> policies = bucket.cors
555
+ >>> policies.append({'origin': '/foo', ...})
556
+ >>> policies[1]['maxAgeSeconds'] = 3600
557
+ >>> del policies[0]
558
+ >>> bucket.cors = policies
559
+
547
560
:setter: Set CORS policies for this bucket.
548
561
:getter: Gets the CORS policies for this bucket.
549
562
@@ -567,11 +580,22 @@ def cors(self, entries):
567
580
568
581
@property
569
582
def labels (self ):
570
- """Retrieve or set CORS policies configured for this bucket.
583
+ """Retrieve or set labels assigned to this bucket.
571
584
572
585
See
573
586
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
574
587
588
+ .. note::
589
+
590
+ The getter for this property returns a dict which is a *copy*
591
+ of the bucket's labels. Mutating that dict has no effect unless
592
+ you then re-assign the dict via the setter. E.g.:
593
+
594
+ >>> labels = bucket.labels
595
+ >>> labels['new_key'] = 'some-label'
596
+ >>> del labels['old_key']
597
+ >>> bucket.labels = labels
598
+
575
599
:setter: Set labels for this bucket.
576
600
:getter: Gets the labels for this bucket.
577
601
@@ -585,7 +609,7 @@ def labels(self):
585
609
586
610
@labels .setter
587
611
def labels (self , mapping ):
588
- """Set CORS policies configured for this bucket.
612
+ """Set labels assigned to this bucket.
589
613
590
614
See
591
615
https://cloud.google.com/storage/docs/json_api/v1/buckets#labels
@@ -627,6 +651,19 @@ def lifecycle_rules(self):
627
651
See https://cloud.google.com/storage/docs/lifecycle and
628
652
https://cloud.google.com/storage/docs/json_api/v1/buckets
629
653
654
+ .. note::
655
+
656
+ The getter for this property returns a list which contains
657
+ *copies* of the bucket's lifecycle rules mappings. Mutating the
658
+ list or one of its dicts has no effect unless you then re-assign
659
+ the dict via the setter. E.g.:
660
+
661
+ >>> rules = bucket.lifecycle_rules
662
+ >>> rules.append({'origin': '/foo', ...})
663
+ >>> rules[1]['rule']['action']['type'] = 'Delete'
664
+ >>> del rules[0]
665
+ >>> bucket.lifecycle_rules = rules
666
+
630
667
:setter: Set lifestyle rules for this bucket.
631
668
:getter: Gets the lifestyle rules for this bucket.
632
669
0 commit comments