Permalink
Browse files

Merge pull request #1408 from jterrace/fix-acl-init

Change default gs.acl.Acl entry list to be an actual Entries object.
  • Loading branch information...
2 parents d8acad5 + fb03dad commit e1edf37978369031683202ada44d4e8bae782efb @mfschwartz mfschwartz committed Mar 25, 2013
Showing with 10 additions and 6 deletions.
  1. +10 −6 boto/gs/acl.py
View
@@ -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):
@@ -125,7 +126,7 @@ def to_xml(self):
return s
-class Entries:
+class Entries(object):
def __init__(self, parent=None):
self.parent = parent
@@ -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):
@@ -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 = {

0 comments on commit e1edf37

Please sign in to comment.