+ def _get_all(self, prefix):
+ return self.client.container_get(prefix=prefix).json
+
+ def _objlist(self, src_cnt, src_path, dst_cnt, dst_path):
+ if src_path and src_path[-1] == '/':
+ src_path = src_path[:-1]
+ self.client.container = src_cnt
+ (src_list_foo, src_list_args) = (None, {})
+
+ try:
+ list_all = False
+ srcobj = self.client.get_object_info(src_path)
+ except ClientError as srcerr:
+ if srcerr not in (404, 204):
+ raise
+ src_list_foo = self.client.list_objects
+ list_all = True
+ else:
+ if self._is_dir(srcobj):
+ if not self['recursive']:
+ raiseCLIError(
+ 'Object %s of cont. %s is a dir' % (
+ src_path,
+ src_cnt),
+ details=['Use --recursive to access directories'])
+ self['src_prefix'] = self.path
+ finally:
+ if self['src_prefix']:
+ if not self.path.startswith(self['src_prefix']):
+ raiseCLIError('Path %s conflicts with prefix %s' % (
+ self.path,
+ self['src_prefix']))
+ src_list_foo = self._get_all,
+ src_list_args = dict(prefix=self['src_prefix'])
+ elif list_all:
+ src_list_foo = self.client.list_objects
+
+ if dst_path and dst_path[-1] == '/':
+ dst_path = dst_path[:-1]
+ if src_list_foo:
+ # N src objects
+ (p, s) = (self['dst_prefix'], self['dst_suffix'])
+ if p or s:
+ for obj in src_list_foo(**src_list_args):
+ name = obj['name']
+ if not name.endswith(self['src_suffix']):
+ continue
+ name = '%s%s%s' % (
+ self['dst_prefix'],
+ name,
+ self['dst_suffix'])
+ else:
+ pass
+ # 1 src object
+
+
+ """