Exemple #1
0
    def get(self):
        user = users.get_current_user()
        if user:
            #User is authenticated
            if not Owner.exists(user):
                #User is not an Owner in DB, add them
                owner = Owner(id=user.user_id(),
                              email=user.email(),
                              nickname=user.nickname(),
                              )
                owner_key = owner.put()
            else:
                #User is an owner in DB, get their key
                owner_key = Owner.get_key(user)

            if Vessel.exists(owner_key):
                #Owner has a vessel, view it
                self.redirect('/myvessel')
            else:
                #Owner does not have a vessel, send to create form
                self.redirect('/newvessel')
        else:
            #redirect to splash
            template = JINJA_ENV.get_template('splash.html')
            self.response.write(template.render(
                loginurl=users.create_login_url('/')
            ))
Exemple #2
0
    def get(self):
        user = users.get_current_user()
        if user:
            #User is authenticated
            if not Owner.exists(user):
                #User is not an Owner in DB, add them
                owner = Owner(id=user.user_id(),
                              email=user.email(),
                              nickname=user.nickname(),
                              )
                owner_key = owner.put()
            else:
                #User is an owner in DB, get their key
                owner_key = Owner.get_key(user)

            if Vessel.exists(owner_key):
                #Owner has a vessel, view it
                self.redirect('/myvessel')
            else:
                #Owner does not have a vessel, send to create form
                self.redirect('/newvessel')
        else:
            #redirect to splash
            template = JINJA_ENV.get_template('splash.html')
            self.response.write(template.render(
                loginurl=users.create_login_url('/')
            ))
Exemple #3
0
 def get(self, extra_params=None):
     template = JINJA_ENV.get_template('newvessel.html')
     params = {'user': users.get_current_user(),
               'logouturl': users.create_logout_url('/'),
               'email': users.get_current_user().email(),
               'countries': COUNTRIES,
               }
     if extra_params:
         params.update(extra_params)
     self.response.write(template.render(params))
Exemple #4
0
 def get(self, extra_params=None):
     template = JINJA_ENV.get_template('newvessel.html')
     params = {
         'user': users.get_current_user(),
         'logouturl': users.create_logout_url('/'),
         'email': users.get_current_user().email(),
         'countries': COUNTRIES,
     }
     if extra_params:
         params.update(extra_params)
     self.response.write(template.render(params))
Exemple #5
0
 def get(self, form_errs=None, form_content=None):
     if not Vessel.exists():
         #owner got here without creating a vessel somehow
         self.redirect('/newvessel')
     else:
         vessel_key = Vessel.get_key()
         params = self.get_template_params(vessel_key)
         params['report_date'] = datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M')
         if form_content:
             params.update(form_content)
         if form_errs:
             params['errors'] = form_errs
         template = JINJA_ENV.get_template('myvessel.html')
         self.response.write(template.render(params))
Exemple #6
0
 def get(self, form_errs=None, form_content=None):
     if not Vessel.exists():
         #owner got here without creating a vessel somehow
         self.redirect('/newvessel')
     else:
         vessel_key = Vessel.get_key()
         params = self.get_template_params(vessel_key)
         params['report_date'] = datetime.datetime.utcnow().strftime(
             '%Y-%m-%d %H:%M')
         if form_content:
             params.update(form_content)
         if form_errs:
             params['errors'] = form_errs
         template = JINJA_ENV.get_template('myvessel.html')
         self.response.write(template.render(params))
Exemple #7
0
 def get(self, waypoint_key_str):
     template = JINJA_ENV.get_template('weather.html')
     waypoint_key = ndb.Key(urlsafe=waypoint_key_str)
     params = self.get_template_params(waypoint_key)
     self.response.write(template.render(params))
Exemple #8
0
 def get(self, vessel_key_str):
     template = JINJA_ENV.get_template('vessel.html')
     vessel_key = ndb.Key(urlsafe=vessel_key_str)
     params = self.get_template_params(vessel_key)
     self.response.write(template.render(params))
Exemple #9
0
 def get(self):
     template = JINJA_ENV.get_template('vessellist.html')
     params = self.get_template_params()
     self.response.write(template.render(params))
Exemple #10
0
 def get(self, waypoint_key_str):
     template = JINJA_ENV.get_template('weather.html')
     waypoint_key = ndb.Key(urlsafe=waypoint_key_str)
     params = self.get_template_params(waypoint_key)
     self.response.write(template.render(params))
Exemple #11
0
 def get(self, vessel_key_str):
     template = JINJA_ENV.get_template('vessel.html')
     vessel_key = ndb.Key(urlsafe=vessel_key_str)
     params = self.get_template_params(vessel_key)
     self.response.write(template.render(params))