Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
main.UserLoginHandler Class Reference
Inheritance diagram for main.UserLoginHandler:

Public Member Functions

 get (self)
 
 collectFeeds (self, prefs, content)
 

Detailed Description

Definition at line 471 of file main.py.

Member Function Documentation

◆ collectFeeds()

main.UserLoginHandler.collectFeeds (   self,
  prefs,
  content 
)

Definition at line 487 of file main.py.

487 def collectFeeds(self, prefs, content):
488 data = json.loads(content)
489
490 queue_name = self.request.get('queue_name', 'priority-queue')
491 sections = {}
492 for feedData in data['subscriptions']:
493 feed = Feed.get_or_insert(feedData['id'])
494 feed.put()
495 category = feedData['categories'][0]
496 categoryId = category['id']
497 if not sections.has_key(categoryId):
498 sections[categoryId] = (category['label'], [])
499
500 # TODO(jimhug): Use Reader preferences to sort feeds in a section.
501 sections[categoryId][1].append(feed.key())
502
503 # Kick off a high priority feed update
504 taskqueue.add(url='/update/feed',
505 queue_name=queue_name,
506 params={'id': feed.key().name()})
507
508 sectionKeys = []
509 for name, (title, feeds) in sections.items():
510 section = Section.get_or_insert(name)
511 section.feeds = feeds
512 section.title = title
513 section.put()
514 # Forces Top to be the first section
515 if title == 'Top': title = '0Top'
516 sectionKeys.append((title, section.key()))
517
518 # TODO(jimhug): Use Reader preferences API to get users true sort order.
519 prefs.sections = [key for t, key in sorted(sectionKeys)]
520 prefs.put()
521
522
static void append(char **dst, size_t *count, const char *src, size_t n)
Definition editor.cpp:211
const char * name
Definition fuchsia.cc:50

◆ get()

main.UserLoginHandler.get (   self)

Definition at line 474 of file main.py.

474 def get(self):
475 user = users.get_current_user()
476 prefs = UserData.get_or_insert(user.user_id())
477 if prefs.credentials:
478 http = prefs.credentials.authorize(httplib2.Http())
479
480 response, content = http.request(
481 '%s/subscription/list?output=json' % READER_API)
482 self.collectFeeds(prefs, content)
483 self.redirect('/')
484 else:
485 self.redirect('/login')
486

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