示例#1
0
  def dispatch(self):
    """Dispatches the current request.

    Basically, we do some quick checks (e.g. to see whether the user is logged in, but hasn't yet set up
    a profile), then defer to the base class's method to do the actual dispatching."""
    self.user = users.get_current_user()
    self.profile = None
    if self.user:
      # they're logged in, so check to see whether they have a profile set up.
      self.profile = profile_ctrl.getProfile(self.user.user_id())
      if not self.profile and self.request.path != '/profile':
        self.redirect('/profile')
        return
      if self.profile and not self.profile.user:
        self.profile.user = self.user
        self.profile.put()
      if self.profile and self.profile.empire_id and not self.profile.realm_name:
        self.profile.realm_name = "Beta"
        self.profile.put()

    super(BaseHandler, self).dispatch()
示例#2
0
    def dispatch(self):
        """Dispatches the current request.

    Basically, we do some quick checks (e.g. to see whether the user is logged in, but hasn't yet set up
    a profile), then defer to the base class's method to do the actual dispatching."""
        self.user = users.get_current_user()
        self.profile = None
        if self.user:
            # they're logged in, so check to see whether they have a profile set up.
            self.profile = profile_ctrl.getProfile(self.user.user_id())
            if not self.profile and self.request.path != '/profile':
                self.redirect('/profile')
                return
            if self.profile and not self.profile.user:
                self.profile.user = self.user
                self.profile.put()
            if self.profile and self.profile.empire_id and not self.profile.realm_name:
                self.profile.realm_name = "Beta"
                self.profile.put()

        super(BaseHandler, self).dispatch()