| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 class GSConnection(S3Connection): | 31 class GSConnection(S3Connection): |
| 32 | 32 |
| 33 DefaultHost = 'commondatastorage.googleapis.com' | 33 DefaultHost = 'commondatastorage.googleapis.com' |
| 34 QueryString = 'Signature=%s&Expires=%d&AWSAccessKeyId=%s' | 34 QueryString = 'Signature=%s&Expires=%d&AWSAccessKeyId=%s' |
| 35 | 35 |
| 36 def __init__(self, gs_access_key_id=None, gs_secret_access_key=None, | 36 def __init__(self, gs_access_key_id=None, gs_secret_access_key=None, |
| 37 is_secure=True, port=None, proxy=None, proxy_port=None, | 37 is_secure=True, port=None, proxy=None, proxy_port=None, |
| 38 proxy_user=None, proxy_pass=None, | 38 proxy_user=None, proxy_pass=None, |
| 39 host=DefaultHost, debug=0, https_connection_factory=None, | 39 host=DefaultHost, debug=0, https_connection_factory=None, |
| 40 calling_format=SubdomainCallingFormat(), path='/'): | 40 calling_format=SubdomainCallingFormat(), path='/', |
| 41 suppress_consec_slashes=True): |
| 41 S3Connection.__init__(self, gs_access_key_id, gs_secret_access_key, | 42 S3Connection.__init__(self, gs_access_key_id, gs_secret_access_key, |
| 42 is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, | 43 is_secure, port, proxy, proxy_port, proxy_user, proxy_pass, |
| 43 host, debug, https_connection_factory, calling_format, path, | 44 host, debug, https_connection_factory, calling_format, path, |
| 44 "google", Bucket) | 45 "google", Bucket, |
| 46 suppress_consec_slashes=suppress_consec_slashes) |
| 45 | 47 |
| 46 def create_bucket(self, bucket_name, headers=None, | 48 def create_bucket(self, bucket_name, headers=None, |
| 47 location=Location.DEFAULT, policy=None): | 49 location=Location.DEFAULT, policy=None): |
| 48 """ | 50 """ |
| 49 Creates a new bucket. By default it's located in the USA. You can | 51 Creates a new bucket. By default it's located in the USA. You can |
| 50 pass Location.EU to create an European bucket. You can also pass | 52 pass Location.EU to create an European bucket. You can also pass |
| 51 a LocationConstraint, which (in addition to locating the bucket | 53 a LocationConstraint, which (in addition to locating the bucket |
| 52 in the specified location) informs Google that Google services | 54 in the specified location) informs Google that Google services |
| 53 must not copy data out of that location. | 55 must not copy data out of that location. |
| 54 | 56 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 83 body = response.read() | 85 body = response.read() |
| 84 if response.status == 409: | 86 if response.status == 409: |
| 85 raise self.provider.storage_create_error( | 87 raise self.provider.storage_create_error( |
| 86 response.status, response.reason, body) | 88 response.status, response.reason, body) |
| 87 if response.status == 200: | 89 if response.status == 200: |
| 88 return self.bucket_class(self, bucket_name) | 90 return self.bucket_class(self, bucket_name) |
| 89 else: | 91 else: |
| 90 raise self.provider.storage_response_error( | 92 raise self.provider.storage_response_error( |
| 91 response.status, response.reason, body) | 93 response.status, response.reason, body) |
| 92 | 94 |
| OLD | NEW |