def create(self, acl=None):
     '''Creates a directory, optionally include Acl argument to set permissions'''
     parent, name = getParentAndBase(self.path)
     json = { 'name': name }
     if acl is not None:
         json['acl'] = acl.to_api_param()
     response = self.client.postJsonHelper(DataDirectory._getUrl(parent), json, False)
     if (response.status_code != 200):
         raise DataApiError("Directory creation failed: " + str(response.content))
Beispiel #2
0
 def getName(self):
     _, name = getParentAndBase(self.path)
     return name
Beispiel #3
0
 def test_getParentAndBase(self):
     self.assertEqual(('a/b', 'c'), getParentAndBase('a/b/c'))
     self.assertEqual(('data://foo', 'bar'),
                      getParentAndBase('data://foo/bar'))
     self.assertEqual(('data:///', 'foo'), getParentAndBase('data:///foo'))
     self.assertEqual(('data://', 'foo'), getParentAndBase('data://foo'))