Commits

spikeekips committed 8e3011e

fixed bugs.

  • Participants
  • Parent commits 6a3fc3d

Comments (0)

Files changed (1)

File storages/backends/s3.py

         if not access_key and not secret_key:
             access_key, secret_key = self._get_access_keys()
 
+        if not access_key or not secret_key :
+            raise ValueError("missing `access key` and `secret key`")
+
         self.connection = AWSAuthConnection(access_key, secret_key,
                             calling_format=calling_format)
         self.generator = QueryStringAuthGenerator(access_key, secret_key,
     def _get_access_keys(self):
         access_key = ACCESS_KEY_NAME
         secret_key = SECRET_KEY_NAME
-        if (access_key or secret_key) and (not access_key or not secret_key):
-            access_key = os.environ.get(ACCESS_KEY_NAME)
-            secret_key = os.environ.get(SECRET_KEY_NAME)
+        #if (access_key or secret_key) and (not access_key or not secret_key):
+        #    access_key = os.environ.get("AWS_ACCESS_KEY")
+        #    secret_key = os.environ.get("AWS_SECRET_KEY")
+
+        if "AWS_ACCESS_KEY" in os.environ :
+             access_key = os.environ.get("AWS_ACCESS_KEY")
+
+        if "AWS_SECRET_KEY" in os.environ :
+             secret_key = os.environ.get("AWS_SECRET_KEY")
 
         if access_key and secret_key:
             # Both were provided, so use them