create account when create container if not exists
authorpapagian <papagian@gmail.com>
Thu, 28 Apr 2011 18:18:08 +0000 (21:18 +0300)
committerpapagian <papagian@gmail.com>
Thu, 28 Apr 2011 18:18:08 +0000 (21:18 +0300)
Refs #447

pithos/backends/dummy.py

index b4df763..95e4f76 100644 (file)
@@ -18,23 +18,22 @@ class BackEnd:
 \r
     def get_account_meta(self, account):\r
         """ returns a dictionary with the container metadata """\r
-        logging.info("get_account_meta: %s %s", account)\r
+        logging.info("get_account_meta: %s", account)\r
         fullname = '/'.join([self.basepath, account])\r
         if not os.path.exists(fullname):\r
             raise NameError('Account does not exist')\r
         contents = os.listdir(fullname) \r
         count = len(contents)\r
         size = sum(os.path.getsize('/'.join([self.basepath, account, objectname])) for objectname in contents)\r
-        return {'name': name, 'count': count, 'bytes': size}\r
+        return {'name': account, 'count': count, 'bytes': size}\r
         \r
     def create_container(self, account, name):\r
         """ creates a new container with the given name\r
         if it doesn't exists under the basepath """\r
-        logging.debug("create_container: %s %s", account, name)\r
+        logging.info("create_container: %s %s", account, name)\r
         fullname = '/'.join([self.basepath, account, name])    \r
         if not os.path.exists(fullname):\r
-            os.chdir(self.basepath)\r
-            os.mkdir(name)\r
+            os.makedirs(fullname)\r
         else:\r
             raise NameError('Container already exists')\r
         return\r