Subversion Repositories SmartDukaan

Rev

Rev 14481 | Rev 14483 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14481 Rev 14482
Line 326... Line 326...
326
            
326
            
327
        result = Mongo.addManualDeals(result_json)
327
        result = Mongo.addManualDeals(result_json)
328
        resp.body = json.dumps(result, encoding='utf-8')
328
        resp.body = json.dumps(result, encoding='utf-8')
329
        
329
        
330
class CommonDelete():
330
class CommonDelete():
-
 
331
    
331
    def on_post(self,req,resp):
332
    def on_post(self,req,resp):
332
        try:
333
        try:
333
            result_json = json.loads(req.stream.read(), encoding='utf-8')
334
            result_json = json.loads(req.stream.read(), encoding='utf-8')
334
        except ValueError:
335
        except ValueError:
335
            raise falcon.HTTPError(falcon.HTTP_400,
336
            raise falcon.HTTPError(falcon.HTTP_400,
Line 338... Line 339...
338
                'JSON was incorrect.')
339
                'JSON was incorrect.')
339
            
340
            
340
        result = Mongo.deleteDocument(result_json)
341
        result = Mongo.deleteDocument(result_json)
341
        resp.body = json.dumps(result, encoding='utf-8')
342
        resp.body = json.dumps(result, encoding='utf-8')
342
        resp.content_type = "application/json; charset=utf-8"
343
        resp.content_type = "application/json; charset=utf-8"
-
 
344
 
-
 
345
class SearchProduct():
-
 
346
    
-
 
347
    def on_get(self,req,resp):
-
 
348
        offset = req.get_param_as_int("offset")
-
 
349
        limit = req.get_param_as_int("limit")
-
 
350
        search_term = req.get_param("search")
-
 
351
        
-
 
352
        result = Mongo.searchMaster(offset, limit, search_term)
-
 
353
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
-
 
354
        resp.body = json_docs
-
 
355
 
-
 
356
        
-
 
357