Skip to content

Commit

Permalink
Merge pull request #1408 from jterrace/fix-acl-init
Browse files Browse the repository at this point in the history
Change default gs.acl.Acl entry list to be an actual Entries object.
  • Loading branch information
mfschwartz committed Mar 25, 2013
2 parents d8acad5 + fb03dad commit e1edf37
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions boto/gs/acl.py
Expand Up @@ -51,11 +51,12 @@
SupportedPermissions = ['READ', 'WRITE', 'FULL_CONTROL']
"""A list of supported ACL permissions."""

class ACL:

class ACL(object):

def __init__(self, parent=None):
self.parent = parent
self.entries = []
self.entries = Entries(self)

@property
def acl(self):
Expand Down Expand Up @@ -125,7 +126,7 @@ def to_xml(self):
return s


class Entries:
class Entries(object):

def __init__(self, parent=None):
self.parent = parent
Expand Down Expand Up @@ -154,15 +155,17 @@ def endElement(self, name, value, connection):
setattr(self, name, value)

def to_xml(self):
if not self.entry_list:
return ''
s = '<%s>' % ENTRIES
for entry in self.entry_list:
s += entry.to_xml()
s += '</%s>' % ENTRIES
return s


# Class that represents a single (Scope, Permission) entry in an ACL.
class Entry:
class Entry(object):

def __init__(self, scope=None, type=None, id=None, name=None,
email_address=None, domain=None, permission=None):
Expand Down Expand Up @@ -219,7 +222,8 @@ def to_xml(self):
s += '</%s>' % ENTRY
return s

class Scope:

class Scope(object):

# Map from Scope type.lower() to lower-cased list of allowed sub-elems.
ALLOWED_SCOPE_TYPE_SUB_ELEMS = {
Expand Down

0 comments on commit e1edf37

Please sign in to comment.