Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
main.UploadFeed Class Reference
Inheritance diagram for main.UploadFeed:

Public Member Functions

def post (self)
 

Detailed Description

Definition at line 254 of file main.py.

Member Function Documentation

◆ post()

def main.UploadFeed.post (   self)

Definition at line 256 of file main.py.

256 def post(self):
257 upload_files = self.request.POST.multi.__dict__['_items']
258 version = self.request.get('version')
259 logging.info('files: %r' % upload_files)
260 for data in upload_files:
261 if data[0] != 'files': continue
262 file = data[1]
263 logging.info('upload feed: %r' % file.filename)
264
265 data = json.loads(file.value)
266
267 feedId = file.filename
268 feed = Feed.get_or_insert(feedId)
269
270 # Find the section to add it to.
271 sectionTitle = data['section']
272 section = findSectionByTitle(sectionTitle)
273 if section != None:
274 if feed.key() in section.feeds:
275 logging.warning('Already contains feed %s, replacing' % feedId)
276 section.feeds.remove(feed.key())
277
278 # Add the feed to the section.
279 section.feeds.insert(0, feed.key())
280 section.put()
281
282 # Add the articles.
283 collectFeed(feed, data)
284
285 else:
286 logging.error('Could not find section %s to add the feed to' %
287 sectionTitle)
288
289 self.redirect('/')
290
291
292# TODO(jimhug): Batch these up and request them more aggressively.
def findSectionByTitle(title)
Definition: main.py:578
def collectFeed(feed, data, continuation=None)
Definition: main.py:585
const myers::Point & get(const myers::Segment &)

The documentation for this class was generated from the following file: