Skip to content

Commit

Permalink
setup_remote_client should return the remote_client rather than setti…
Browse files Browse the repository at this point in the history
…ng it.
  • Loading branch information
Rémy HUBSCHER committed Jan 22, 2016
1 parent 4dc096d commit 6a99d25
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions kinto_client/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,27 +200,29 @@ def setup_remote_client(self, remote_client=None):
self.args['bucket'],
self.args['collection']))

self.remote_client = Client(server_url=self.args['host'],
auth=self.args['auth'],
bucket=self.args['bucket'],
collection=self.args['collection'])
remote_client = Client(server_url=self.args['host'],
auth=self.args['auth'],
bucket=self.args['bucket'],
collection=self.args['collection'])

# Create bucket
# XXX: Move this to a configure
# XXX: Add a create if not exist functionality
try:
self.remote_client.create_bucket(
remote_client.create_bucket(
permissions=self.bucket_permissions)
except KintoException as e:
if not hasattr(e, 'response') or e.response.status_code != 412:
raise e
try:
self.remote_client.create_collection(
remote_client.create_collection(
permissions=self.collection_permissions)
except KintoException as e:
if e.response.status_code != 412:
raise e

return remote_client

def get_remote_records(self):
self.logger.log(COMMAND_LOG_LEVEL, 'Working on %r' % self.args['host'])
return list(self.remote_client.get_records())
Expand Down

0 comments on commit 6a99d25

Please sign in to comment.