Permalink
Browse files

Change default gs.acl.Acl entry list to be an actual Entries object.

  • Loading branch information...
1 parent d8acad5 commit fb03dad7bd0fe99cd3c42148c2fb8ecc9fffa91b @jterrace jterrace 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 fb03dad

Please sign in to comment.