Subversion Repositories SmartDukaan

Rev

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

Rev 14011 Rev 14013
Line 42... Line 42...
42
        resp.body = json.dumps(result, encoding='utf-8')
42
        resp.body = json.dumps(result, encoding='utf-8')
43
        
43
        
44
class Track():
44
class Track():
45
    def on_post(self, req, resp, userId):
45
    def on_post(self, req, resp, userId):
46
        try:
46
        try:
-
 
47
            string1 = req.stream.read()
-
 
48
            print string1
-
 
49
        except ValueError:
-
 
50
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
51
                'Malformed JSON',
-
 
52
                'Could not decode the request body. The '
-
 
53
                'JSON was incorrect.')
-
 
54
        try:
47
            store = main.getStore(req.get_param_as_int("storeId"))
55
            store = main.getStore(req.get_param_as_int("storeId"))
48
            if req.get_param_as_int("storeId") == 1:
56
            if req.get_param_as_int("storeId") == 1:
49
                result = store.trackOrdersForUser(int(userId),req.get_param('url'),req.get_param('html'))
57
                result = store.trackOrdersForUser(int(userId),1,2)
50
                resp.body = json.dumps({'result':result}, encoding='utf-8')
58
                resp.body = json.dumps({'result':result}, encoding='utf-8')
51
            else:
59
            else:
52
                resp.body = json.dumps({'result':'NOT_IMPLEMENTED'}, encoding='utf-8')
60
                resp.body = json.dumps({'result':'NOT_IMPLEMENTED'}, encoding='utf-8')
53
        except:
61
        except:
54
            resp.body = json.dumps({'result':'PARSE_ERROR'}, encoding='utf-8')
62
            resp.body = json.dumps({'result':'PARSE_ERROR'}, encoding='utf-8')