OLD | NEW |
1 # Copyright 2010 Google Inc. | 1 # Copyright 2010 Google Inc. |
2 # | 2 # |
3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
9 # lowing conditions: | 9 # lowing conditions: |
10 # | 10 # |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 self.parent = parent | 54 self.parent = parent |
55 self.entries = [] | 55 self.entries = [] |
56 | 56 |
57 @property | 57 @property |
58 def acl(self): | 58 def acl(self): |
59 return self | 59 return self |
60 | 60 |
61 def __repr__(self): | 61 def __repr__(self): |
62 # Owner is optional in GS ACLs. | 62 # Owner is optional in GS ACLs. |
63 if hasattr(self, 'owner'): | 63 if hasattr(self, 'owner'): |
| 64 entries_repr = ['Owner:%s' % self.owner.__repr__()] |
| 65 else: |
64 entries_repr = [''] | 66 entries_repr = [''] |
65 else: | |
66 entries_repr = ['Owner:%s' % self.owner.__repr__()] | |
67 acl_entries = self.entries | 67 acl_entries = self.entries |
68 if acl_entries: | 68 if acl_entries: |
69 for e in acl_entries.entry_list: | 69 for e in acl_entries.entry_list: |
70 entries_repr.append(e.__repr__()) | 70 entries_repr.append(e.__repr__()) |
71 return '<%s>' % ', '.join(entries_repr) | 71 return '<%s>' % ', '.join(entries_repr) |
72 | 72 |
73 # Method with same signature as boto.s3.acl.ACL.add_email_grant(), to allow | 73 # Method with same signature as boto.s3.acl.ACL.add_email_grant(), to allow |
74 # polymorphic treatment at application layer. | 74 # polymorphic treatment at application layer. |
75 def add_email_grant(self, permission, email_address): | 75 def add_email_grant(self, permission, email_address): |
76 entry = Entry(type=USER_BY_EMAIL, email_address=email_address, | 76 entry = Entry(type=USER_BY_EMAIL, email_address=email_address, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 s += '<%s>%s</%s>' % (NAME, self.name, NAME) | 271 s += '<%s>%s</%s>' % (NAME, self.name, NAME) |
272 elif self.type == GROUP_BY_ID or self.type == USER_BY_ID: | 272 elif self.type == GROUP_BY_ID or self.type == USER_BY_ID: |
273 s += '<%s>%s</%s>' % (ID, self.id, ID) | 273 s += '<%s>%s</%s>' % (ID, self.id, ID) |
274 if self.name: | 274 if self.name: |
275 s += '<%s>%s</%s>' % (NAME, self.name, NAME) | 275 s += '<%s>%s</%s>' % (NAME, self.name, NAME) |
276 else: | 276 else: |
277 raise InvalidAclError('Invalid scope type "%s" ', self.type) | 277 raise InvalidAclError('Invalid scope type "%s" ', self.type) |
278 | 278 |
279 s += '</%s>' % SCOPE | 279 s += '</%s>' % SCOPE |
280 return s | 280 return s |
OLD | NEW |