Subversion Repositories SmartDukaan

Rev

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

Rev 15081 Rev 15229
Line 6... Line 6...
6
from dtr import main
6
from dtr import main
7
from dtr.storage import Mongo, Mysql
7
from dtr.storage import Mongo, Mysql
8
import falcon
8
import falcon
9
import json
9
import json
10
import urlparse
10
import urlparse
-
 
11
import re
11
class StoreOrder():
12
class StoreOrder():
12
    def on_post(self, req, resp):
13
    def on_post(self, req, resp):
13
        
14
        
14
        try:
15
        try:
15
            string1 = req.stream.read()
16
            string1 = req.stream.read()
Line 153... Line 154...
153
        
154
        
154
class RawHtml():
155
class RawHtml():
155
    def on_get(self, req, resp, orderId):
156
    def on_get(self, req, resp, orderId):
156
        try:
157
        try:
157
            result = Mysql.getOrderHtml(orderId)
158
            result = Mysql.getOrderHtml(orderId)
-
 
159
            result = re.subn(r'(src|href|style)=\s?(\'|").*?\2(?s)', '', re.subn(r'<(script|style).*?</\1>(?s)', '', result)[0])[0]
158
            resp.body = result
160
            resp.body = result
159
            resp.content_type = 'text/html'
161
            resp.content_type = 'text/html'
160
        except ValueError:
162
        except ValueError:
161
            raise falcon.HTTPError(falcon.HTTP_400,
163
            raise falcon.HTTPError(falcon.HTTP_400,
162
                'Malformed JSON',
164
                'Malformed JSON',