Subversion Repositories SmartDukaan

Rev

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

Rev 14483 Rev 14495
Line 350... Line 350...
350
        
350
        
351
        result = Mongo.searchMaster(offset, limit, search_term)
351
        result = Mongo.searchMaster(offset, limit, search_term)
352
        resp.body = dumps(result) 
352
        resp.body = dumps(result) 
353
 
353
 
354
        
354
        
-
 
355
class FeaturedDeals():
355
    
356
    
-
 
357
    def on_get(self, req, resp):
-
 
358
        
-
 
359
        offset = req.get_param_as_int("offset")
-
 
360
        limit = req.get_param_as_int("limit")
-
 
361
        
-
 
362
        result = Mongo.getAllFeaturedDeals(offset, limit)
-
 
363
        resp.body = dumps(result)
-
 
364
 
-
 
365
    
-
 
366
    def on_post(self, req, resp):
-
 
367
        
-
 
368
        try:
-
 
369
            result_json = json.loads(req.stream.read(), encoding='utf-8')
-
 
370
        except ValueError:
-
 
371
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
372
                'Malformed JSON',
-
 
373
                'Could not decode the request body. The '
-
 
374
                'JSON was incorrect.')
-
 
375
            
-
 
376
        result = Mongo.addFeaturedDeal(result_json)
-
 
377
        resp.body = json.dumps(result, encoding='utf-8')
-
 
378
 
-
 
379
    
-
 
380