Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/gsutil/boto/boto/gs/acl.py

Issue 10199002: Upgrade gsutil to 3.4 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/gsutil/boto/boto/gs/__init__.py ('k') | third_party/gsutil/boto/boto/gs/bucket.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/gsutil/boto/boto/gs/acl.py
diff --git a/third_party/gsutil/20110627/boto/boto/gs/acl.py b/third_party/gsutil/boto/boto/gs/acl.py
similarity index 87%
rename from third_party/gsutil/20110627/boto/boto/gs/acl.py
rename to third_party/gsutil/boto/boto/gs/acl.py
index 0846f018a3e7be5e9993cb1813f20f921ad61ab9..93bb4a9c2634361a48efaf661efbb7b5e64de615 100755
--- a/third_party/gsutil/20110627/boto/boto/gs/acl.py
+++ b/third_party/gsutil/boto/boto/gs/acl.py
@@ -25,6 +25,7 @@ from boto.exception import InvalidAclError
ACCESS_CONTROL_LIST = 'AccessControlList'
ALL_AUTHENTICATED_USERS = 'AllAuthenticatedUsers'
ALL_USERS = 'AllUsers'
+DISPLAY_NAME = 'DisplayName'
DOMAIN = 'Domain'
EMAIL_ADDRESS = 'EmailAddress'
ENTRY = 'Entry'
@@ -61,9 +62,9 @@ class ACL:
def __repr__(self):
# Owner is optional in GS ACLs.
if hasattr(self, 'owner'):
- entries_repr = ['']
- else:
entries_repr = ['Owner:%s' % self.owner.__repr__()]
+ else:
+ entries_repr = ['']
acl_entries = self.entries
if acl_entries:
for e in acl_entries.entry_list:
@@ -173,7 +174,22 @@ class Entry:
def startElement(self, name, attrs, connection):
if name == SCOPE:
- if not TYPE in attrs:
+ # The following if statement used to look like this:
+ # if not TYPE in attrs:
+ # which caused problems because older versions of the
+ # AttributesImpl class in the xml.sax library neglected to include
+ # a __contains__() method (which Python calls to implement the
+ # 'in' operator). So when you use the in operator, like the if
+ # statement above, Python invokes the __getiter__() method with
+ # index 0, which raises an exception. More recent versions of
+ # xml.sax include the __contains__() method, rendering the in
+ # operator functional. The work-around here is to formulate the
+ # if statement as below, which is the legal way to query
+ # AttributesImpl for containment (and is also how the added
+ # __contains__() method works). At one time gsutil disallowed
+ # xmlplus-based parsers, until this more specific problem was
+ # determined.
+ if not attrs.has_key(TYPE):
raise InvalidAclError('Missing "%s" in "%s" part of ACL' %
(TYPE, SCOPE))
self.scope = Scope(self, attrs[TYPE])
@@ -208,10 +224,10 @@ class Scope:
ALL_AUTHENTICATED_USERS : [],
ALL_USERS : [],
GROUP_BY_DOMAIN : [DOMAIN],
- GROUP_BY_EMAIL : [EMAIL_ADDRESS, NAME],
- GROUP_BY_ID : [ID, NAME],
- USER_BY_EMAIL : [EMAIL_ADDRESS, NAME],
- USER_BY_ID : [ID, NAME]
+ GROUP_BY_EMAIL : [DISPLAY_NAME, EMAIL_ADDRESS, NAME],
+ GROUP_BY_ID : [DISPLAY_NAME, ID, NAME],
+ USER_BY_EMAIL : [DISPLAY_NAME, EMAIL_ADDRESS, NAME],
+ USER_BY_ID : [DISPLAY_NAME, ID, NAME]
}
def __init__(self, parent, type=None, id=None, name=None,
« no previous file with comments | « third_party/gsutil/boto/boto/gs/__init__.py ('k') | third_party/gsutil/boto/boto/gs/bucket.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698