@@ -127,55 +127,41 @@ def grant(self, role):
127
127
128
128
:type role: string
129
129
:param role: The role to add to the entity.
130
-
131
- :rtype: :class:`_ACLEntity`
132
- :returns: The entity class.
133
130
"""
134
131
self .roles .add (role )
135
- return self
136
132
137
133
def revoke (self , role ):
138
134
"""Remove a role from the entity.
139
135
140
136
:type role: string
141
137
:param role: The role to remove from the entity.
142
-
143
- :rtype: :class:`_ACLEntity`
144
- :returns: The entity class.
145
138
"""
146
139
if role in self .roles :
147
140
self .roles .remove (role )
148
- return self
149
141
150
142
def grant_read (self ):
151
143
"""Grant read access to the current entity."""
152
-
153
- return self .grant (_ACLEntity .READER_ROLE )
144
+ self .grant (_ACLEntity .READER_ROLE )
154
145
155
146
def grant_write (self ):
156
147
"""Grant write access to the current entity."""
157
-
158
- return self .grant (_ACLEntity .WRITER_ROLE )
148
+ self .grant (_ACLEntity .WRITER_ROLE )
159
149
160
150
def grant_owner (self ):
161
151
"""Grant owner access to the current entity."""
162
-
163
- return self .grant (_ACLEntity .OWNER_ROLE )
152
+ self .grant (_ACLEntity .OWNER_ROLE )
164
153
165
154
def revoke_read (self ):
166
155
"""Revoke read access from the current entity."""
167
-
168
- return self .revoke (_ACLEntity .READER_ROLE )
156
+ self .revoke (_ACLEntity .READER_ROLE )
169
157
170
158
def revoke_write (self ):
171
159
"""Revoke write access from the current entity."""
172
-
173
- return self .revoke (_ACLEntity .WRITER_ROLE )
160
+ self .revoke (_ACLEntity .WRITER_ROLE )
174
161
175
162
def revoke_owner (self ):
176
163
"""Revoke owner access from the current entity."""
177
-
178
- return self .revoke (_ACLEntity .OWNER_ROLE )
164
+ self .revoke (_ACLEntity .OWNER_ROLE )
179
165
180
166
181
167
class ACL (object ):
@@ -234,7 +220,8 @@ def entity_from_dict(self, entity_dict):
234
220
if not isinstance (entity , _ACLEntity ):
235
221
raise ValueError ('Invalid dictionary: %s' % entity_dict )
236
222
237
- return entity .grant (role )
223
+ entity .grant (role )
224
+ return entity
238
225
239
226
def has_entity (self , entity ):
240
227
"""Returns whether or not this ACL has any entries for an entity.
@@ -361,8 +348,9 @@ def get_entities(self):
361
348
def reload (self ):
362
349
"""Reload the ACL data from Cloud Storage.
363
350
364
- :rtype: :class:`ACL`
365
- :returns: The current ACL.
351
+ This is a virtual method, expected to be implemented by subclasses.
352
+
353
+ :raises: :class:`NotImplementedError`
366
354
"""
367
355
raise NotImplementedError
368
356
@@ -396,11 +384,7 @@ def __init__(self, bucket):
396
384
self .bucket = bucket
397
385
398
386
def reload (self ):
399
- """Reload the ACL data from Cloud Storage.
400
-
401
- :rtype: :class:`gcloud.storage.acl.BucketACL`
402
- :returns: The current ACL.
403
- """
387
+ """Reload the ACL data from Cloud Storage."""
404
388
self .entities .clear ()
405
389
406
390
url_path = '%s/%s' % (self .bucket .path , self ._URL_PATH_ELEM )
@@ -409,8 +393,6 @@ def reload(self):
409
393
for entry in found .get ('items' , ()):
410
394
self .add_entity (self .entity_from_dict (entry ))
411
395
412
- return self
413
-
414
396
def save (self , acl = None ):
415
397
"""Save this ACL for the current bucket.
416
398
@@ -434,9 +416,6 @@ def save(self, acl=None):
434
416
:type acl: :class:`gcloud.storage.acl.ACL`, or a compatible list.
435
417
:param acl: The ACL object to save. If left blank, this will save
436
418
current entries.
437
-
438
- :rtype: :class:`gcloud.storage.acl.BucketACL`
439
- :returns: The current ACL.
440
419
"""
441
420
if acl is None :
442
421
acl = self
@@ -454,8 +433,6 @@ def save(self, acl=None):
454
433
self .add_entity (self .entity_from_dict (entry ))
455
434
self .loaded = True
456
435
457
- return self
458
-
459
436
def clear (self ):
460
437
"""Remove all ACL entries.
461
438
@@ -477,11 +454,8 @@ def clear(self):
477
454
>>> acl.clear()
478
455
479
456
At this point all the custom rules you created have been removed.
480
-
481
- :rtype: :class:`gcloud.storage.acl.BucketACL`
482
- :returns: The current ACL.
483
457
"""
484
- return self .save ([])
458
+ self .save ([])
485
459
486
460
487
461
class DefaultObjectACL (BucketACL ):
@@ -502,11 +476,7 @@ def __init__(self, blob):
502
476
self .blob = blob
503
477
504
478
def reload (self ):
505
- """Reload the ACL data from Cloud Storage.
506
-
507
- :rtype: :class:`ObjectACL`
508
- :returns: The current ACL.
509
- """
479
+ """Reload the ACL data from Cloud Storage."""
510
480
self .entities .clear ()
511
481
512
482
url_path = '%s/acl' % self .blob .path
@@ -515,8 +485,6 @@ def reload(self):
515
485
for entry in found .get ('items' , ()):
516
486
self .add_entity (self .entity_from_dict (entry ))
517
487
518
- return self
519
-
520
488
def save (self , acl = None ):
521
489
"""Save the ACL data for this blob.
522
490
@@ -539,8 +507,6 @@ def save(self, acl=None):
539
507
self .add_entity (self .entity_from_dict (entry ))
540
508
self .loaded = True
541
509
542
- return self
543
-
544
510
def clear (self ):
545
511
"""Remove all ACL rules from the blob.
546
512
@@ -549,4 +515,4 @@ def clear(self):
549
515
have access to a blob that you created even after you clear ACL
550
516
rules with this method.
551
517
"""
552
- return self .save ([])
518
+ self .save ([])
0 commit comments