Esempio n. 1
0
 def login(self, url=h.encodeURL('/')):
     """
     Show login form
     """
     c.messageCode = request.GET.get('messageCode')
     c.url = h.decodeURL(url)
     c.publicKey = config['extra']['recaptcha']['public']
     return render('/people/login.mako')
Esempio n. 2
0
 def register(self):
     """
     Show account registration page.
     """
     c.title = 'Registration'
     c.button_label = 'Register'
     c.save_url_name = 'person_register_'
     c.success_message = 'Please check your email to create your account.'
     return render('/people/change.mako')
Esempio n. 3
0
 def index(self):
     """
     Show information about people registered in the database.
     """
     # Initialize
     query = meta.Session.query(model.Person)
     # Get
     c.person_count = query.count()
     c.random_people = query.order_by(sa.func.random()).limit(10).all()
     # Return
     return render('/people/index.mako')
Esempio n. 4
0
 def update(self):
     """
     Show account update page.
     """
     # If the person is not logged in,
     if not h.isPerson():
         return ''
     # Get
     person = meta.Session.query(model.Person).get(session['personID'])
     # Render
     c.title = 'Update'
     c.button_label = 'Update'
     c.save_url_name = 'person_update_'
     c.success_message = 'Please check your email to finalize changes to your account.'
     form = render('/people/change.mako')
     # Return
     return htmlfill.render(form, {
         'username': person.username,
         'nickname': person.nickname,
         'email': person.email,
         'email_sms': person.email_sms,
     })
 def index(self):
     c.windows = meta.Session.query(model.Window).all()
     c.datasets = meta.Session.query(model.Dataset).filter_by(is_complete=True).all()
     c.datasets_jobs = meta.Session.query(model.Job).filter_by(type=model.job_combineDatasets).all()
     return render('/datasets/index.mako')
Esempio n. 6
0
 def index(self):
     c.images = meta.Session.query(model.Image).all()
     c.regions = meta.Session.query(model.Region).filter_by(is_complete=True).all()
     c.region_jobs = meta.Session.query(model.Job).filter_by(type=model.job_defineRegions).all()
     return render('/regions/index.mako')
Esempio n. 7
0
 def index(self):
     # Return a rendered template
     #return render('/scan.mako')
     # or, return a response
     return render('/scans/index.mako')
Esempio n. 8
0
            form['email'], form['email_sms'])
        confirmation.person_id = person.id if person else None
        confirmation.ticket = store.makeRandomUniqueTicket(parameter.TICKET_LENGTH, meta.Session.query(model.PersonConfirmation))
        confirmation.when_expired = datetime.datetime.now() + datetime.timedelta(days=parameter.TICKET_LIFESPAN_IN_DAYS)
        meta.Session.add(confirmation) 
        meta.Session.commit()
        # Prepare recipient
        toByValue = dict(nickname=form['nickname'], email=form['email'])
        # Prepare subject
        subject = '[%s] Confirm %s' % (parameter.SITE_NAME, action)
        # Prepare body
        c.ticket = confirmation.ticket
        c.when_expired = confirmation.when_expired
        c.username = form['username']
        c.action = action
        body = render(templatePath)
        # Send
        try:
            mail.sendMessage(config['extra']['mail_support'], toByValue, subject, body)
        except mail.Error:
            return dict(isOk=0, errorByID={
                'status': 'Unable to send confirmation email; please try again later.'
            })
        # Return
        return {'isOk': 1}


def purgeExpiredPersonConfirmations():
    """
    Delete confirmations that have expired
    """
Esempio n. 9
0
 def index(self):
     c.personCount = meta.Session.query(model.Person).count()
     c.jobCount = meta.Session.query(model.Job).count()
     c.jobPendingCount = meta.Session.query(model.Job).filter(model.Job.pickled_output==None).count()
     return render('/index.mako')
Esempio n. 10
0
 def index(self):
     c.regions = meta.Session.query(model.Region).filter_by(is_complete=True).all()
     c.windows = meta.Session.query(model.Window).filter_by(is_complete=True).all()
     c.window_jobs = meta.Session.query(model.Job).filter_by(type=model.job_sampleWindows)
     return render('/windows/index.mako')
 def index(self):
     c.regions = meta.Session.query(model.Region).filter_by(is_complete=True).all()
     return render('/classifiers/index.mako')
Esempio n. 12
0
 def analyze(self):
     c.images = meta.Session.query(model.Image).all()
     c.classifiers = meta.Session.query(model.Classifier).all()
     return render('/images/analyze.mako')
Esempio n. 13
0
 def index(self):
     """
     Show a list of images
     """
     c.images = meta.Session.query(model.Image).all()
     return render('/images/index.mako')