Subversion Repositories SmartDukaan

Rev

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

Rev 13966 Rev 13969
Line 13... Line 13...
13
        result = Mongo.getAllCategoryDiscount()
13
        result = Mongo.getAllCategoryDiscount()
14
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
14
        json_docs = [json.dumps(doc, default=json_util.default) for doc in result]
15
        resp.body = json.dumps(json_docs, encoding='utf-8')
15
        resp.body = json.dumps(json_docs, encoding='utf-8')
16
    
16
    
17
    def on_post(self, req, resp):
17
    def on_post(self, req, resp):
-
 
18
        print "Inside post"
18
        
19
        
19
        try:
20
        try:
20
            result_json = json.loads(req.stream.read(), encoding='utf-8')
21
            result_json = json.loads(req.stream.read(), encoding='utf-8')
21
        except ValueError:
22
        except ValueError:
22
            raise falcon.HTTPError(falcon.HTTP_400,
23
            raise falcon.HTTPError(falcon.HTTP_400,
Line 24... Line 25...
24
                'Could not decode the request body. The '
25
                'Could not decode the request body. The '
25
                'JSON was incorrect.')
26
                'JSON was incorrect.')
26
            
27
            
27
        result = Mongo.addCategoryDiscount(result_json)
28
        result = Mongo.addCategoryDiscount(result_json)
28
        resp.body = json.dumps(result, encoding='utf-8')
29
        resp.body = json.dumps(result, encoding='utf-8')
-
 
30
    
-
 
31
    def on_put(self, req, resp, _id):
-
 
32
        print "Inside on_put"
-
 
33
        
29
        
34
        
30
class SkuSchemeDetails(object):
35
class SkuSchemeDetails(object):
31
    
36
    
32
    def on_get(self, req, resp):
37
    def on_get(self, req, resp):
33
        
38