Skip to content
Snippets Groups Projects
Commit f9d333ef authored by Gunnar Schaefer's avatar Gunnar Schaefer
Browse files

adapt insert_one calls to new return value

parent 38d54b5f
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,7 @@ class Acquisitions(containers.ContainerList):
json_body['files'] = []
if 'timestamp' in json_body:
json_body['timestamp'] = util.parse_timestamp(json_body['timestamp'])
return {'_id': str(self.dbc.insert_one(json_body))}
return {'_id': str(self.dbc.insert_one(json_body).inserted_id)}
def get(self, sid):
"""Return the list of Session Acquisitions."""
......
......@@ -199,7 +199,7 @@ class Collections(containers.ContainerList):
json_body['curator'] = self.uid
json_body['timestamp'] = datetime.datetime.utcnow()
json_body['permissions'] = [{'_id': self.uid, 'access': 'admin'}]
return {'_id': str(self.dbc.insert_one(json_body))}
return {'_id': str(self.dbc.insert_one(json_body).inserted_id)}
def get(self):
"""Return the list of Collections."""
......
......@@ -244,7 +244,7 @@ class Container(base.RequestHandler):
filepath = os.path.join(self.app.config['data_path'], str(_id)[-3:] + '/' + str(_id), filename)
if self.request.GET.get('ticket') == '': # request for download ticket
ticket = util.download_ticket(self.request.client_addr, 'file', _id, filename, fileinfo['filesize'])
return {'ticket': self.app.db.downloads.insert_one(ticket)}
return {'ticket': self.app.db.downloads.insert_one(ticket).inserted_id}
else: # authenticated or ticketed (unauthenticated) download
zip_member = self.request.GET.get('member')
if self.request.GET.get('info', '').lower() in ('1', 'true'):
......
......@@ -110,7 +110,7 @@ class Projects(containers.ContainerList):
json_body['public'] = json_body.get('public', False)
json_body['files'] = []
json_body['timestamp'] = datetime.datetime.utcnow()
return {'_id': str(self.dbc.insert_one(json_body))}
return {'_id': str(self.dbc.insert_one(json_body).inserted_id)}
def get(self, uid=None, gid=None):
"""Return the User's list of Projects."""
......
......@@ -100,7 +100,7 @@ class Sessions(containers.ContainerList):
json_body['files'] = []
if 'timestamp' in json_body:
json_body['timestamp'] = util.parse_timestamp(json_body['timestamp'])
return {'_id': str(self.dbc.insert_one(json_body))}
return {'_id': str(self.dbc.insert_one(json_body).inserted_id)}
def get(self, pid=None, gid=None):
"""Return the list of project or group sessions."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment