def register_post(self): if (c.userid != "false"): redirect(url('/users/register?m=3')) if request.method == 'POST': c.form = RegisterForm(request.POST) if c.form.is_valid(): newuser = model.user() # check to see if email allready exists email_users = meta.Session.query(model.user) if (validate_email(c.form.cleaned_data['email'])): c.email = "invalid" print("invalid email") return render("/users/register.mako") newuser.email = c.form.cleaned_data['email'] newuser.organization = c.form.cleaned_data['organization'] newuser.password = c.form.cleaned_data['password'] print("c.form.cleaned_data['password']", c.form.cleaned_data['password']) newuser.salt = "salt" meta.Session.add(newuser) meta.Session.commit() return render("/users/succ_register.mako") else: c.form = RegisterForm(request.POST) return render("/users/register.mako")
def register_post(self): if (c.userid != "false"): redirect(url('/users/register?m=3')) if request.method == 'POST': c.form = RegisterForm(request.POST) if c.form.is_valid(): newuser= model.user() # check to see if email allready exists email_users = meta.Session.query(model.user) if (validate_email(c.form.cleaned_data['email'])): c.email = "invalid" print "invalid email" return render("/users/register.mako") newuser.email = c.form.cleaned_data['email'] newuser.organization = c.form.cleaned_data['organization'] newuser.password = c.form.cleaned_data['password'] print "c.form.cleaned_data['password']", c.form.cleaned_data['password'] newuser.salt = "salt" meta.Session.add(newuser) meta.Session.commit() return render("/users/succ_register.mako") else: c.form = RegisterForm(request.POST) return render("/users/register.mako")
def login_validate(self): if (c.userid != "false"): redirect(url('/users/login?m=2')) session['logged_in'] = True session.save() if request.method == 'POST': c.form = LoginForm(request.POST) if c.form.is_valid(): userid = authenticate_user(c.form.cleaned_data['email'], \ c.form.cleaned_data['password']) print "hellooooo", c.form.cleaned_data['email'], c.form.cleaned_data['password'] if (userid != "invalid" ): session['userid'] = userid session.save() print session['userid'] redirect(url('/')) c.login = "******" else: c.login = "******" else: c.form = LoginForm(request.POST) return render("/users/login.mako")
def job_table_view(self): user_jobs = meta.Session.query(model.job).all() c.jobs = paginate.Page(user_jobs, items_per_page=10) total_pages = len(user_jobs)/10 + 1 #jobs = meta.Session.query(model.job) #if (len(user_jobs)!=0): # print "\njobs------\n",jobs.first().jobinfo[1].key, jobs.first().jobinfo[1].value # to check if user visiting this page for the first time and #assign the latest jobs page,page_num tell which page to show page_num = total_pages if ('page' in request.params) and request.params['page']. isdigit() and (int(request.params['page']) <= total_pages): page_num =int(request.params['page']) if 'm' in request.params: c.display_message = "Job successfully submitted and your Job ID is " \ + str(request.params['id']) c.jobs = paginate.Page(user_jobs, page=page_num, items_per_page=10) c.pagenums=c.jobs.pager() c.pagenumber = page_num return render("/job_table_view.mako")
def job_insert(self): if (c.userid == "false"): redirect(url('/users/login?m=1')) #extra_questions = get_questions(request) #form = UserCreationForm(request.POST or None, extra=extra_questions) if request.method == 'POST': appname = request.POST['appname'] if (appname =='tophatfusion'): c.form = tophatfusionForm(request.POST,request.POST ) elif (appname =='bfast') : c.form = bfastForm(request.POST,request.POST ) elif (appname =='chipseq') : c.form = chipseqForm(request.POST,request.POST ) if c.form.is_valid(): #add using job queue jobid =add_job(c.userid) for key in c.form.cleaned_data: print "key", key print "value", c.form.cleaned_data[key] newjobinfo = model.jobinfo() newjobinfo.key = key newjobinfo.value = c.form.cleaned_data[key] newjobinfo.submitted_time = time.asctime() newjobinfo.jobid = jobid add_jobinfo(newjobinfo) update_job_status(jobid, str(JOBSTATES.NEW)) redirect(url('/ngs/job_table_view?m=1&id=' + str(jobid) )) else: return render('/forms/chipseq_form.mako')
def job_insert(self): if (c.userid == "false"): redirect(url('/users/login?m=1')) #extra_questions = get_questions(request) #form = UserCreationForm(request.POST or None, extra=extra_questions) if request.method == 'POST': appname = request.POST['appname'] if (appname =='tophatfusion'): c.form = tophatfusionForm(request.POST,request.POST ) elif (appname =='bfast') : c.form = bfastForm(request.POST,request.POST ) elif (appname =='chipseq') : c.form = chipseqForm(request.POST,request.POST ) if c.form.is_valid(): #add using job queue jobid =add_job(c.userid) for key in c.form.cleaned_data: print("key", key) print("value", c.form.cleaned_data[key]) newjobinfo = model.jobinfo() newjobinfo.key = key newjobinfo.value = c.form.cleaned_data[key] newjobinfo.submitted_time = time.asctime() newjobinfo.jobid = jobid add_jobinfo(newjobinfo) update_job_status(jobid, str(JOBSTATES.NEW)) redirect(url('/ngs/job_table_view?m=1&id=' + str(jobid) )) else: return render('/forms/chipseq_form.mako')
def login_validate(self): if (c.userid != "false"): redirect(url('/users/login?m=2')) session['logged_in'] = True session.save() if request.method == 'POST': c.form = LoginForm(request.POST) if c.form.is_valid(): userid = authenticate_user(c.form.cleaned_data['email'], \ c.form.cleaned_data['password']) print("hellooooo", c.form.cleaned_data['email'], c.form.cleaned_data['password']) if (userid != "invalid"): session['userid'] = userid session.save() print(session['userid']) redirect(url('/')) c.login = "******" else: c.login = "******" else: c.form = LoginForm(request.POST) return render("/users/login.mako")
def register(self): if 'm' in request.params: m = request.params['m'] if (int(m) ==3): c.display_message = "Please log out before you register " elif (c.userid != "false"): redirect(url('/users/regitser?m=3')) c.form = RegisterForm() return render('/users/register.mako')
def register(self): if 'm' in request.params: m = request.params['m'] if (int(m) == 3): c.display_message = "Please log out before you register " elif (c.userid != "false"): redirect(url('/users/regitser?m=3')) c.form = RegisterForm() return render('/users/register.mako')
def login(self): #h.flash('Please login') if 'm' in request.params: m = request.params['m'] if (int(m) ==1): c.display_message = "Please log in before you submit a job " if (int(m) ==2): c.display_message = "Please log out before you login " if (int(m) ==4): c.display_message = "Please log in before you delete a job " elif (c.userid != "false"): redirect(url('/users/login?m=2')) c.form = LoginForm() return render('/users/login.mako')
def login(self): #h.flash('Please login') if 'm' in request.params: m = request.params['m'] if (int(m) == 1): c.display_message = "Please log in before you submit a job " if (int(m) == 2): c.display_message = "Please log out before you login " if (int(m) == 4): c.display_message = "Please log in before you delete a job " elif (c.userid != "false"): redirect(url('/users/login?m=2')) c.form = LoginForm() return render('/users/login.mako')
def dalliance(self): """ dalliance visual""" return render('/dalliance.mako')
def bfast_form(self): if (c.userid == "false"): redirect(url('/users/login?m=1')) c.form = bfastForm() return render('/forms/bfast_form.mako')
def using_bfast(self): return render('/pages/using_bfast.mako')
def resources(self): return render('/pages/resources.mako')
def software(self): return render('/pages/software.mako')
def about(self): return render('/pages/about.mako')
def using_tophatfusion(self): return render('/pages/using_tophatfusion.mako')
def tophatfusion_form(self): if (c.userid == "false"): redirect(url('/users/login?m=1')) c.form = tophatfusionForm() return render('/forms/tophatfusion_form.mako')
def using_chipseq(self): return render('/pages/using_chipseq.mako')
def contact(self): return render('/pages/contact.mako')
def trac(self): return render('/pages/trac.mako')
def chipseq_form(self): if (c.userid == "false"): redirect(url('/users/login?m=1')) c.form = chipseqForm() return render('/forms/chipseq_form.mako')
def index(self): return render('/pages/index.mako')
def tophatfusion_view(self): """ dalliance visual""" jobid= request.params['id'] if jobid is None: redirect(url('/ngs/job_table_view')) return render('/results/result_'+ jobid+'.mako')