Subversion Repositories SmartDukaan

Rev

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

Rev 17499 Rev 17556
Line 1430... Line 1430...
1430
    def on_get(self,req, resp):
1430
    def on_get(self,req, resp):
1431
        categoryId = req.get_param_as_int("categoryId")
1431
        categoryId = req.get_param_as_int("categoryId")
1432
        offset = req.get_param_as_int("offset")
1432
        offset = req.get_param_as_int("offset")
1433
        limit = req.get_param_as_int("limit")
1433
        limit = req.get_param_as_int("limit")
1434
        result = Mongo.getDummyDeals(categoryId, offset, limit)
1434
        result = Mongo.getDummyDeals(categoryId, offset, limit)
1435
        resp.body = dumps(result) 
1435
        resp.body = dumps(result)
1436
 
1436
 
1437
class PincodeValidation():
1437
class PincodeValidation():
1438
    def on_get(self,req,resp,pincode):
1438
    def on_get(self,req,resp,pincode):
1439
        json_data={}
1439
        json_data={}
1440
        cities=[]
1440
        cities=[]
Line 1451... Line 1451...
1451
                resp.body = json.dumps("{}")       
1451
                resp.body = json.dumps("{}")       
1452
        else:
1452
        else:
1453
            resp.body = json.dumps("{}")
1453
            resp.body = json.dumps("{}")
1454
        session.close()
1454
        session.close()
1455
 
1455
 
-
 
1456
class SearchDummyDeals():
-
 
1457
    def on_get(self,req,resp):
-
 
1458
        offset = req.get_param_as_int("offset")
-
 
1459
        limit = req.get_param_as_int("limit")
-
 
1460
        searchTerm = req.get_param("searchTerm")
-
 
1461
        result = Mongo.searchDummyDeals(searchTerm, limit, offset)
-
 
1462
        resp.body = dumps(result)
-
 
1463
 
-
 
1464
class DummyPricing:
-
 
1465
    def on_get(self,req,resp):
-
 
1466
        skuBundleId = req.get_param_as_int("skuBundleId")
-
 
1467
        result = Mongo.getDummyPricing(skuBundleId)
-
 
1468
        resp.body = dumps(result)
-
 
1469
 
-
 
1470
class DealObject:
-
 
1471
    def on_post(self,req, resp):
-
 
1472
            
-
 
1473
        try:
-
 
1474
            result_json = json.loads(req.stream.read(), encoding='utf-8')
-
 
1475
        except ValueError:
-
 
1476
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
1477
                'Malformed JSON',
-
 
1478
                'Could not decode the request body. The '
-
 
1479
                'JSON was incorrect.')
-
 
1480
        result = Mongo.addDealObject(result_json)
-
 
1481
        resp.body = dumps(result)
-
 
1482
    
-
 
1483
    
-
 
1484
    
1456
def main():
1485
def main():
1457
    #tagActivatedReatilers()
1486
    #tagActivatedReatilers()
1458
    a = RetailerDetail()
1487
    a = RetailerDetail()
1459
    retailer = a.getNotActiveRetailer()
1488
    retailer = a.getNotActiveRetailer()
1460
    otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
1489
    otherContacts = [r for r, in session.query(RetailerContacts.mobile_number).filter_by(retailer_id=retailer.id).order_by(RetailerContacts.contact_type).all()]
1461
    print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
1490
    print json.dumps(todict(getRetailerObj(retailer, otherContacts, 'fresh')), encoding='utf-8')
1462
    #print make_tiny("AA")
1491
    #print make_tiny("AA")
1463
    
1492
    
1464
    
-
 
1465
if __name__ == '__main__':
1493
if __name__ == '__main__':
1466
    main()
1494
    main()
1467
        
1495
        
1468
1496