Subversion Repositories SmartDukaan

Rev

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

Rev 15716 Rev 15852
Line 122... Line 122...
122
            raise falcon.HTTPError(falcon.HTTP_400,
122
            raise falcon.HTTPError(falcon.HTTP_400,
123
                'Malformed JSON',
123
                'Malformed JSON',
124
                'Could not decode the request body. The '
124
                'Could not decode the request body. The '
125
                'JSON was incorrect.')
125
                'JSON was incorrect.')
126
            
126
            
127
        result = Mongo.addSchemeDetailsForSku(result_json, multi)
127
        result = Mongo.addSchemeDetailsForSku(result_json)
128
        resp.body = json.dumps(result, encoding='utf-8')
128
        resp.body = json.dumps(result, encoding='utf-8')
129
        
129
        
130
class SkuDiscountInfo():
130
class SkuDiscountInfo():
131
    
131
    
132
    def on_get(self, req, resp):
132
    def on_get(self, req, resp):
Line 148... Line 148...
148
            raise falcon.HTTPError(falcon.HTTP_400,
148
            raise falcon.HTTPError(falcon.HTTP_400,
149
                'Malformed JSON',
149
                'Malformed JSON',
150
                'Could not decode the request body. The '
150
                'Could not decode the request body. The '
151
                'JSON was incorrect.')
151
                'JSON was incorrect.')
152
            
152
            
153
        result = Mongo.addSkuDiscountInfo(result_json, multi)
153
        result = Mongo.addSkuDiscountInfo(result_json)
154
        resp.body = json.dumps(result, encoding='utf-8')
154
        resp.body = json.dumps(result, encoding='utf-8')
155
        
155
        
156
    def on_put(self, req, resp, _id):
156
    def on_put(self, req, resp, _id):
157
        try:
157
        try:
158
            result_json = json.loads(req.stream.read(), encoding='utf-8')
158
            result_json = json.loads(req.stream.read(), encoding='utf-8')
Line 186... Line 186...
186
            raise falcon.HTTPError(falcon.HTTP_400,
186
            raise falcon.HTTPError(falcon.HTTP_400,
187
                'Malformed JSON',
187
                'Malformed JSON',
188
                'Could not decode the request body. The '
188
                'Could not decode the request body. The '
189
                'JSON was incorrect.')
189
                'JSON was incorrect.')
190
            
190
            
191
        result = Mongo.addExceptionalNlc(result_json, multi)
191
        result = Mongo.addExceptionalNlc(result_json)
192
        resp.body = json.dumps(result, encoding='utf-8')
192
        resp.body = json.dumps(result, encoding='utf-8')
193
    
193
    
194
    def on_put(self, req, resp, _id):
194
    def on_put(self, req, resp, _id):
195
        try:
195
        try:
196
            result_json = json.loads(req.stream.read(), encoding='utf-8')
196
            result_json = json.loads(req.stream.read(), encoding='utf-8')
Line 325... Line 325...
325
            raise falcon.HTTPError(falcon.HTTP_400,
325
            raise falcon.HTTPError(falcon.HTTP_400,
326
                'Malformed JSON',
326
                'Malformed JSON',
327
                'Could not decode the request body. The '
327
                'Could not decode the request body. The '
328
                'JSON was incorrect.')
328
                'JSON was incorrect.')
329
            
329
            
330
        result = Mongo.addSkuDealerPrice(result_json, multi)
330
        result = Mongo.addSkuDealerPrice(result_json)
331
        resp.body = json.dumps(result, encoding='utf-8')
331
        resp.body = json.dumps(result, encoding='utf-8')
332
    
332
    
333
    def on_put(self, req, resp, _id):
333
    def on_put(self, req, resp, _id):
334
        try:
334
        try:
335
            result_json = json.loads(req.stream.read(), encoding='utf-8')
335
            result_json = json.loads(req.stream.read(), encoding='utf-8')
Line 367... Line 367...
367
            raise falcon.HTTPError(falcon.HTTP_400,
367
            raise falcon.HTTPError(falcon.HTTP_400,
368
                'Malformed JSON',
368
                'Malformed JSON',
369
                'Could not decode the request body. The '
369
                'Could not decode the request body. The '
370
                'JSON was incorrect.')
370
                'JSON was incorrect.')
371
            
371
            
372
        result = Mongo.updateCollection(result_json, multi)
372
        result = Mongo.updateCollection(result_json)
373
        resp.body = json.dumps(result, encoding='utf-8')
373
        resp.body = json.dumps(result, encoding='utf-8')
374
        resp.content_type = "application/json; charset=utf-8"
374
        resp.content_type = "application/json; charset=utf-8"
375
 
375
 
376
class NegativeDeals():
376
class NegativeDeals():
377
    
377