Subversion Repositories SmartDukaan

Rev

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

Rev 16810 Rev 16814
Line 163... Line 163...
163
                'JSON was incorrect.')
163
                'JSON was incorrect.')
164
            
164
            
165
            
165
            
166
    def on_post(self, request, resp):
166
    def on_post(self, request, resp):
167
        try:
167
        try:
-
 
168
            boundary = request.content_type.split(";")[1].strip().split("=")[1]
168
            print request.content_type
169
            chunks = []
169
            filepath = "/tmp/rejectfile"
170
            filepath = "/tmp/rejectfile"
170
            with open(filepath, 'wb') as image_file:
171
            with open(filepath, 'wb') as image_file:
171
                while True:
172
                while True:
172
                    chunk = request.stream.read(4096)
173
                    chunk = request.stream.read(4096)
173
                    if not chunk:
174
                    if not chunk:
174
                        break
175
                        break
-
 
176
                    chunks.append(chunk) 
175
    
177
                
-
 
178
                chunk = "".join(chunks)
-
 
179
                chunk = utils.find_between(chunk, boundary, boundary)
-
 
180
                chunk = chunk.split("\n\n")[1]    
176
                    image_file.write(chunk)
181
                image_file.write(chunk)
177
                    print chunk
182
                print chunk
178
 
183
 
179
            rejectCount = process_rejects(filepath) #this function is not yet implemented
184
            rejectCount = process_rejects(filepath) #this function is not yet implemented
180
            
185
            
181
            resp.body = """
186
            resp.body = """
182
                <html><head><title>Upload Rejects</title></head><body>
187
                <html><head><title>Upload Rejects</title></head><body>