git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@409 830e0280-6d2a-0410-9c65-932aecc39d9d
Michal Ludvig authored on 2010/05/20 20:12:41... | ... |
@@ -1088,14 +1088,14 @@ def cmd_setacl(args): |
1088 | 1088 |
if acl.isAnonRead(): |
1089 | 1089 |
info(u"%s: already Public, skipping %s" % (uri, seq_label)) |
1090 | 1090 |
if not cfg.acl_grants and not cfg.acl_revokes: |
1091 |
- return; |
|
1091 |
+ return |
|
1092 | 1092 |
else: |
1093 | 1093 |
acl.grantAnonRead() |
1094 | 1094 |
elif cfg.acl_public == False: # we explicitely check for False, because it could be None |
1095 | 1095 |
if not acl.isAnonRead(): |
1096 | 1096 |
info(u"%s: already Private, skipping %s" % (uri, seq_label)) |
1097 | 1097 |
if not cfg.acl_grants and not cfg.acl_revokes: |
1098 |
- return; |
|
1098 |
+ return |
|
1099 | 1099 |
else: |
1100 | 1100 |
acl.revokeAnonRead() |
1101 | 1101 |
|
... | ... |
@@ -1103,11 +1103,11 @@ def cmd_setacl(args): |
1103 | 1103 |
# grant first and revoke later, because revoke has priority |
1104 | 1104 |
if cfg.acl_grants: |
1105 | 1105 |
for grant in cfg.acl_grants: |
1106 |
- acl.grant( **grant ); |
|
1106 |
+ acl.grant(**grant); |
|
1107 | 1107 |
|
1108 | 1108 |
if cfg.acl_revokes: |
1109 | 1109 |
for revoke in cfg.acl_revokes: |
1110 |
- acl.revoke( **revoke ); |
|
1110 |
+ acl.revoke(**revoke); |
|
1111 | 1111 |
|
1112 | 1112 |
retsponse = s3.set_acl(uri, acl) |
1113 | 1113 |
if retsponse['status'] == 200: |
... | ... |
@@ -1559,8 +1559,7 @@ def main(): |
1559 | 1559 |
optparser.add_option("-r", "--recursive", dest="recursive", action="store_true", help="Recursive upload, download or removal.") |
1560 | 1560 |
optparser.add_option("-P", "--acl-public", dest="acl_public", action="store_true", help="Store objects with ACL allowing read for anyone.") |
1561 | 1561 |
optparser.add_option( "--acl-private", dest="acl_public", action="store_false", help="Store objects with default ACL allowing access for you only.") |
1562 |
- |
|
1563 |
- optparser.add_option( "--acl-grant", dest="acl_grants", action="append", metavar="PERMISSION:EMAIL OR USER_CANONICAL_ID", help="Grant stated permission to a given amazon user. Permission is one of: read, write, read_acp, write_acp, full_control, all") |
|
1562 |
+ optparser.add_option( "--acl-grant", dest="acl_grants", action="append", metavar="PERMISSION:EMAIL or USER_CANONICAL_ID", help="Grant stated permission to a given amazon user. Permission is one of: read, write, read_acp, write_acp, full_control, all") |
|
1564 | 1563 |
optparser.add_option( "--acl-revoke", dest="acl_revokes", action="append", metavar="PERMISSION:USER_CANONICAL_ID", help="Revoke stated permission for a given amazon user. Permission is one of: read, write, read_acp, wr ite_acp, full_control, all") |
1565 | 1564 |
|
1566 | 1565 |
optparser.add_option( "--delete-removed", dest="delete_removed", action="store_true", help="Delete remote objects with no corresponding local file [sync]") |
... | ... |
@@ -1676,25 +1675,24 @@ def main(): |
1676 | 1676 |
permission_re = "(?P<PERMISSION>read(_acp)?|write(_acp)?|full_control|all)" |
1677 | 1677 |
|
1678 | 1678 |
if options.acl_grants: |
1679 |
- r_acl_grant = re.compile( "^%s:(?P<NAME>.+)$" % permission_re, re.IGNORECASE) |
|
1679 |
+ r_acl_grant = re.compile("^%s:(?P<NAME>.+)$" % permission_re, re.IGNORECASE) |
|
1680 | 1680 |
for grant in options.acl_grants: |
1681 |
- is_data = r_acl_grant.match( grant ) |
|
1681 |
+ is_data = r_acl_grant.match(grant) |
|
1682 | 1682 |
if is_data: |
1683 | 1683 |
data = is_data.groupdict() |
1684 |
- cfg.acl_grants.append( {'name': data['NAME'].lower(), 'permission': data["PERMISSION"].upper()} ) |
|
1684 |
+ cfg.acl_grants.append({'name': data['NAME'].lower(), 'permission': data["PERMISSION"].upper()}) |
|
1685 | 1685 |
else: |
1686 |
- warning( u"skipped invalid --acl-grant option: [%s]" % grant) |
|
1686 |
+ warning(u"skipped invalid --acl-grant option: [%s]" % grant) |
|
1687 | 1687 |
|
1688 | 1688 |
if options.acl_revokes: |
1689 |
- r_acl_revoke = re.compile( "^%s:(?P<NAME>[a-f0-9]+)$" % permission_re, re.IGNORECASE) |
|
1689 |
+ r_acl_revoke = re.compile("^%s:(?P<NAME>.+)$" % permission_re, re.IGNORECASE) |
|
1690 | 1690 |
for revoke in options.acl_revokes: |
1691 |
- is_data = r_acl_revoke.match( revoke ) |
|
1691 |
+ is_data = r_acl_revoke.match(revoke) |
|
1692 | 1692 |
if is_data: |
1693 | 1693 |
data = is_data.groupdict() |
1694 |
- cfg.acl_revokes.append( {'name': data['NAME'].lower(), 'permission': data["PERMISSION"].upper()} ) |
|
1694 |
+ cfg.acl_revokes.append({'name': data['NAME'].lower(), 'permission': data["PERMISSION"].upper()}) |
|
1695 | 1695 |
else: |
1696 |
- warning( u"skipped invalid --acl-revoke option: [%s]" % revoke) |
|
1697 |
- |
|
1696 |
+ warning(u"skipped invalid --acl-revoke option: [%s]" % revoke) |
|
1698 | 1697 |
|
1699 | 1698 |
## Update Config with other parameters |
1700 | 1699 |
for option in cfg.option_list(): |