Subversion Repositories SmartDukaan

Rev

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

Rev 16823 Rev 16824
Line 167... Line 167...
167
            
167
            
168
    def on_post(self, request, resp):
168
    def on_post(self, request, resp):
169
        
169
        
170
        try:
170
        try:
171
            boundary = request.content_type.split(";")[1].strip().split("=")[1]
171
            boundary = request.content_type.split(";")[1].strip().split("=")[1]
172
            pdict = {'boundary':boundary}
-
 
173
            chunks = []
172
            chunks = []
174
            filepath = "/tmp/rejectfile"
173
            filepath = "/tmp/rejectfile"
175
            with open(filepath, 'wb') as image_file:
174
            with open(filepath, 'wb') as image_file:
176
                while True:
175
                while True:
177
                    chunk = request.stream.read(4096)
176
                    chunk = request.stream.read(4096)
Line 181... Line 180...
181
                
180
                
182
                chunk = "".join(chunks)
181
                chunk = "".join(chunks)
183
                nextpart = "--" + boundary
182
                nextpart = "--" + boundary
184
                lastpart = "--" + boundary + "--"
183
                lastpart = "--" + boundary + "--"
185
                
184
                
-
 
185
                print chunk
186
                chunk = find_between(chunk, nextpart, lastpart)
186
                chunk = find_between(chunk, nextpart, lastpart)
187
                chunk = chunk.split("\n\n")[1]
187
                chunk = chunk.split("\n\n")[1]
188
                print chunk
188
                print chunk
189
                image_file.write(chunk)
189
                image_file.write(chunk)
190
            rejectCount = process_rejects(filepath) #this function is not yet implemented
190
            rejectCount = process_rejects(filepath) #this function is not yet implemented