Subversion Repositories SmartDukaan

Rev

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

Rev 17723 Rev 18156
Line 10... Line 10...
10
from dtr.utils import utils
10
from dtr.utils import utils
11
from dtr.utils.utils import find_between
11
from dtr.utils.utils import find_between
12
import cgi
12
import cgi
13
import falcon
13
import falcon
14
import json
14
import json
15
import logging
-
 
16
import os.path
15
import os.path
17
import re
16
import re
18
import traceback
17
import traceback
19
import urlparse
18
import urlparse
20
import xlrd
19
import xlrd
21
 
20
 
22
logging.basicConfig(filename='/var/log/uwsgi/order.log',level=logging.WARNING)
-
 
23
 
-
 
24
 
-
 
25
order_fliters = {
21
order_fliters = {
26
                 "monitor":{
22
                 "monitor":{
27
                    "trackingurlmissing":  {
23
                    "trackingurlmissing":  {
28
                                                "displaylabel":"Tracking Url Missing",
24
                                                "displaylabel":"Tracking Url Missing",
29
                                                "query":{"subOrders.closed":False,"subOrders.trackingUrl":{"$exists":False}, "subOrders.trackMissing":True}
25
                                                "query":{"subOrders.closed":False,"subOrders.trackingUrl":{"$exists":False}, "subOrders.trackMissing":True}
Line 50... Line 46...
50
    def on_post(self, req, resp):
46
    def on_post(self, req, resp):
51
        
47
        
52
        try:
48
        try:
53
            string1 = req.stream.read()
49
            string1 = req.stream.read()
54
            req_json = json.loads(string1, encoding='utf-8')
50
            req_json = json.loads(string1, encoding='utf-8')
55
            print "req_json",req_json
-
 
56
        except ValueError:
51
        except ValueError:
57
            raise falcon.HTTPError(falcon.HTTP_400,
52
            raise falcon.HTTPError(falcon.HTTP_400,
58
                'Malformed JSON',
53
                'Malformed JSON',
59
                'Could not decode the request body. The '
54
                'Could not decode the request body. The '
60
                'JSON was incorrect.')
55
                'JSON was incorrect.')
Line 119... Line 114...
119
class Track():
114
class Track():
120
    def on_post(self, req, resp, userId):
115
    def on_post(self, req, resp, userId):
121
        try:
116
        try:
122
            string1 = req.stream.read()
117
            string1 = req.stream.read()
123
            req_obj = urlparse.parse_qs(string1)
118
            req_obj = urlparse.parse_qs(string1)
124
            logging.warn(string1)
-
 
125
        except ValueError:
119
        except ValueError:
126
            raise falcon.HTTPError(falcon.HTTP_400,
120
            raise falcon.HTTPError(falcon.HTTP_400,
127
                'Malformed JSON',
121
                'Malformed JSON',
128
                'Could not decode the request body. The '
122
                'Could not decode the request body. The '
129
                'JSON was incorrect.')
123
                'JSON was incorrect.')
130
        try:
124
        try:
131
            store = main.getStore(req.get_param_as_int("storeId"))
125
            store = main.getStore(req.get_param_as_int("storeId"))
132
            print "req_obj",req_obj
-
 
133
            result = store.trackOrdersForUser(int(userId),req_obj['url'][0],req_obj['html'][0])
126
            result = store.trackOrdersForUser(int(userId),req_obj['url'][0],req_obj['html'][0])
134
            resp.body = json.dumps({'result':result}, encoding='utf-8')
127
            resp.body = json.dumps({'result':result}, encoding='utf-8')
135
            '''
128
            '''
136
            elif req.get_param_as_int("storeId") == 7:
129
            elif req.get_param_as_int("storeId") == 7:
137
                if 'myprofile' in req_obj['url'][0]:
130
                if 'myprofile' in req_obj['url'][0]: