def post(self): parser = reqparse.RequestParser() parser.add_argument('entry',type=dict) args = parser.parse_args().entry print "Entry POST"+str(args) user = wrappers.getDoc('user',args['user']) dataset = wrappers.getDoc('dataset',args['dataset']) contents = args['contents'] if type(args['contents']) is dict else [args['contents']] try: entry = wrappers.createEntry(user,dataset,contents) return {'entry': fixKey(entry.to_json())},200 except ValueError as e: return {'err': e.message}, 403 return {'entry': fixKey(entry.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('user',type=dict) args = parser.parse_args().user print "User POST: "+str(args) newUser = wrappers.createUser(args['username'],args['name'],customers = wrappers.getDoc('customers',args['customers']), datasets = wrappers.getDoc('datasets',args['datasets'])) return {'user': fixKey(newUser.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('dataset',type=dict) args = parser.parse_args().dataset print "Dataset POST: "+str(args) customer = wrappers.getDoc('customer',args['customer']) dataset = wrappers.createDataset(customer,args['title']) return {'dataset':fixKey(dataset.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('datasetColumn',type=dict) args = parser.parse_args()['datasetColumn'] print "DatasetColumn POST: "+str(args) dataset = wrappers.getDoc('dataset',args['dataset']) datasetColumn = wrappers.setDatasetSchemaColumn(dataset,args['order'],args['name'],args['expected']) return {'datasetColumn':fixKey(datasetColumn.to_json())},200
def post(self): parser = reqparse.RequestParser() parser.add_argument('customer',type=dict) args = parser.parse_args().customer print "Customer POST: "+str(args) name = args['name'] users = wrappers.getDoc('user',args.get('users',[])) datasets = wrappers.getDoc('dataset', args.get('datasets',[])) customer = wrappers.createCustomer(name,datasets=datasets,users=users) return {'customer':fixKey(customer.to_json())},200
def put(self,uid): parser = reqparse.RequestParser() parser.add_argument('customer',type=dict) args = parser.parse_args().customer print "Customer PUT: "+str(args) customer = wrappers.getDoc('customer',uid) for k,v in args.iteritems(): if wrappers.getDoc(k,v) is not None: customer[k] = wrappers.getDoc(k,v) else: customer[k] = v customer.save() return {'customer':fixKey(customer.to_json())},200
def put(self,uid): parser = reqparse.RequestParser() parser.add_argument('dataset',type=dict) args = parser.parse_args().dataset print "Dataset PUT: "+str(args) dataset = wrappers.getDoc('dataset',uid) for k,v in args.iteritems(): if wrappers.getDoc(k,v) is not None: dataset[k] = wrappers.getDoc(k,v) else: dataset[k] = v dataset.save() return {'dataset':fixKey(dataset.to_json())},200
def get(self): where_args = literal_eval(request.args.get('where','{}')) print "Entries GET ("+str(type(where_args))+"): "+str(where_args) return {'entries': [fixKey(entry.to_json()) for entry in wrappers.Entry.objects(**where_args)]}
def get(self,uid): return {'entry': fixKey(wrappers.Entry.objects(id=uid).get().to_json())}
def get(self): where_args = literal_eval(request.args.get('where','{}')) print "Customer GET: "+str(where_args) return {'customers': [fixKey(customer.to_json()) for customer in wrappers.Customer.objects(**where_args)]}
def get(self,uid): return {'customer': fixKey(wrappers.Customer.objects(id=uid).get().to_json())}
def get(self,uid): return {'dataset': fixKey(wrappers.Dataset.objects(id=uid).get().to_json())}
def get(self): where_args = literal_eval(request.args.get('where','{}')) print "Dataset GET: "+str(where_args) return {'datasets': [fixKey(dataset.to_json()) for dataset in wrappers.Dataset.objects(**where_args)]}
def get(self,uid): return {'user': fixKey(wrappers.User.objects(id=uid).get().to_json())}
def get(self): where_args = literal_eval(request.args.get('where','{}')) print "Users GET: "+str(where_args) return {'users': [fixKey(user.to_json()) for user in wrappers.User.objects(**where_args)]}
def get(self): where_args = literal_eval(request.args.get('where','{}')) print "EntryCells GET: "+str(where_args) return {'entryCells': [fixKey(entry_cell.to_json()) for entry_cell in wrappers.EntryCell.objects(**where_args)]}