Skip to content

Commit ddefb77

Browse files
committed
Merge pull request #156 from dhermes/fix-overloaded-keyword
Removing overloaded global "type" from storage.acl.
2 parents d539467 + 7829d27 commit ddefb77

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

gcloud/storage/acl.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ class Entity(object):
9090
outside of using the factor methods on the :class:`ACL` object.
9191
"""
9292

93-
def __init__(self, type, identifier=None):
93+
def __init__(self, entity_type, identifier=None):
9494
"""
95-
:type type: string
96-
:param type: The type of entity (ie, 'group' or 'user').
95+
:type entity_type: string
96+
:param entity_type: The type of entity (ie, 'group' or 'user').
9797
9898
:type identifier: string
9999
:param identifier: The ID or e-mail of the entity.
@@ -103,7 +103,7 @@ def __init__(self, type, identifier=None):
103103

104104
self.identifier = identifier
105105
self.roles = set([])
106-
self.type = type
106+
self.type = entity_type
107107

108108
def __str__(self):
109109
if not self.identifier:
@@ -218,8 +218,8 @@ def entity_from_dict(self, entity_dict):
218218
entity = self.all_authenticated()
219219

220220
elif '-' in entity:
221-
type, identifier = entity.split('-', 1)
222-
entity = self.entity(type=type, identifier=identifier)
221+
entity_type, identifier = entity.split('-', 1)
222+
entity = self.entity(entity_type=entity_type, identifier=identifier)
223223

224224
if not isinstance(entity, ACL.Entity):
225225
raise ValueError('Invalid dictionary: %s' % entity_dict)
@@ -262,16 +262,17 @@ def add_entity(self, entity):
262262

263263
self.entities[str(entity)] = entity
264264

265-
def entity(self, type, identifier=None):
265+
def entity(self, entity_type, identifier=None):
266266
"""Factory method for creating an Entity.
267267
268268
If an entity with the same type and identifier already exists,
269269
this will return a reference to that entity.
270270
If not, it will create a new one and add it to the list
271271
of known entities for this ACL.
272272
273-
:type type: string
274-
:param type: The type of entity to create (ie, ``user``, ``group``, etc)
273+
:type entity_type: string
274+
:param entity_type: The type of entity to create
275+
(ie, ``user``, ``group``, etc)
275276
276277
:type identifier: string
277278
:param identifier: The ID of the entity (if applicable).
@@ -281,7 +282,7 @@ def entity(self, type, identifier=None):
281282
:returns: A new Entity or a refernece to an existing identical entity.
282283
"""
283284

284-
entity = ACL.Entity(type=type, identifier=identifier)
285+
entity = ACL.Entity(entity_type=entity_type, identifier=identifier)
285286
if self.has_entity(entity):
286287
entity = self.get_entity(entity)
287288
else:

0 commit comments

Comments
 (0)