Subversion Repositories SmartDukaan

Rev

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

Rev 14024 Rev 14058
Line 3... Line 3...
3
 
3
 
4
@author: amit
4
@author: amit
5
'''
5
'''
6
from dtr import main
6
from dtr import main
7
from dtr.storage import Mongo
7
from dtr.storage import Mongo
-
 
8
import datetime
8
import falcon
9
import falcon
9
import json
10
import json
10
import urlparse
11
import urlparse
11
class StoreOrder():
12
class StoreOrder():
12
    def on_post(self, req, resp):
13
    def on_post(self, req, resp):
Line 53... Line 54...
53
                'Could not decode the request body. The '
54
                'Could not decode the request body. The '
54
                'JSON was incorrect.')
55
                'JSON was incorrect.')
55
        try:
56
        try:
56
            store = main.getStore(req.get_param_as_int("storeId"))
57
            store = main.getStore(req.get_param_as_int("storeId"))
57
            if req.get_param_as_int("storeId") == 1:
58
            if req.get_param_as_int("storeId") == 1:
58
                print "RAWHTML ----",req_obj['html'][0]
59
                f = open("/tmp/order"+str(datetime.datetime.now()),'w')
-
 
60
                f.write('hi there\n') # python will convert \n to os.linesep
-
 
61
                f.close() # you can omit in most cases as the destructor will call if
-
 
62
 
59
                result = store.trackOrdersForUser(int(userId),req_obj['url'][0],req_obj['html'][0])
63
                result = store.trackOrdersForUser(int(userId),req_obj['url'][0],req_obj['html'][0])
60
                resp.body = json.dumps({'result':result}, encoding='utf-8')
64
                resp.body = json.dumps({'result':result}, encoding='utf-8')
61
            else:
65
            else:
62
                resp.body = json.dumps({'result':'NOT_IMPLEMENTED'}, encoding='utf-8')
66
                resp.body = json.dumps({'result':'NOT_IMPLEMENTED'}, encoding='utf-8')
63
        except:
67
        except: