Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Integrate dataset exists and create on write API
Browse files Browse the repository at this point in the history
Implement the newly created dataset_exists and create_dataset from the
MongoStorageEngine.
  • Loading branch information
robyoung committed May 24, 2014
1 parent 7a75595 commit b85e301
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions backdrop/write/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def create_collection_for_dataset(dataset_name):
if not _allow_create_collection(request.headers.get('Authorization')):
abort(401, 'Unauthorized: invalid or no token given.')

if db.collection_exists(dataset_name):
if storage.dataset_exists(dataset_name):
abort(400, 'Collection exists with that name.')

try:
Expand All @@ -191,10 +191,7 @@ def create_collection_for_dataset(dataset_name):
if capped_size is None or not isinstance(capped_size, int):
abort(400, 'You must specify an int capped_size of 0 or more')

if capped_size == 0:
db.create_uncapped_collection(dataset_name)
else:
db.create_capped_collection(dataset_name, capped_size)
storage.create_dataset(dataset_name, capped_size)

return jsonify(status='ok', message='Created "{}"'.format(dataset_name))

Expand Down

0 comments on commit b85e301

Please sign in to comment.