140 def post(self):
141 upload_files = self.request.POST.multi.__dict__['_items']
142 version = self.request.
get(
'version')
143 logging.info('files: %r' % upload_files)
144 for data in upload_files:
145 if data[0] != 'files': continue
146 file = data[1]
147 filename = file.filename
148 if version:
149 filename = '%s-%s' % (version, filename)
150 logging.info('upload: %r' % filename)
151
152 htmlFile = HtmlFile.get_or_insert(filename)
153 htmlFile.filename = filename
154
155
156 text = file.value
157 if len(text) > 1024 * 1023:
158 data = StringIO.StringIO()
159 gz = gzip.GzipFile(str(filename), 'wb', fileobj=data)
160 gz.write(text)
161 gz.close()
162 htmlFile.content = data.getvalue()
163 htmlFile.compressed = True
164 else:
165 htmlFile.content = text
166 htmlFile.compressed = False
167
168 htmlFile.put()
169
170 self.redirect('/')
171
172
const myers::Point & get(const myers::Segment &)