Subversion Repositories SmartDukaan

Rev

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

Rev 13804 Rev 13868
Line 25... Line 25...
25
    
25
    
26
    def on_get(self, req, resp, userId):
26
    def on_get(self, req, resp, userId):
27
        page = req.get_param_as_int("page")
27
        page = req.get_param_as_int("page")
28
        window = req.get_param_as_int("window")
28
        window = req.get_param_as_int("window")
29
        result = Mongo.getMerchantOrdersByUser(int(userId), page, window)
29
        result = Mongo.getMerchantOrdersByUser(int(userId), page, window)
30
        resp.body = json.dumps(result, encoding='utf-8')
-
 
31
30
        resp.body = json.dumps(result, encoding='utf-8')
-
 
31
        
-
 
32
class Track():
-
 
33
    def on_post(self, req, resp):
-
 
34
        try:
-
 
35
            string1 = req.stream.read()
-
 
36
            req_json = json.loads(string1, encoding='utf-8')
-
 
37
        except ValueError:
-
 
38
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
39
                'Malformed JSON',
-
 
40
                'Could not decode the request body. The '
-
 
41
                'JSON was incorrect.')
-
 
42
        
-
 
43
        store = main.getStore(int(req_json['sourceId']))
-
 
44
        return store.getUrls(int(req_json['userId']))
-
 
45
    
-
 
46
    def on_get(self, req, resp):
-
 
47
        try:
-
 
48
            userId = req.get_param_as_int("userId")
-
 
49
            storeId = req.get_param_as_int("storeId")
-
 
50
            store = main.getStore(storeId)
-
 
51
            return store.getTrackingUrls(userId)
-
 
52
        except ValueError:
-
 
53
            raise falcon.HTTPError(falcon.HTTP_400,
-
 
54
                'Malformed JSON',
-
 
55
                'Could not decode the request body. The '
-
 
56
                'JSON was incorrect.')
-
 
57
        
-
 
58
        
-
 
59
32
60