示例#1
0
    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")
示例#2
0
    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")
示例#3
0
    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")
示例#4
0
    def namd_job_insert(self):
        if (c.userid == "false"):
             redirect(url('/users/login?m=1'))
        else:
        
            if request.method == 'POST':
                appname  = request.POST['appname']
                if (appname =='namd'):
                    num = request.POST["numresources"]
                    numf = request.POST["numfiles"]
                    
                    p  = NAMDForm(request.POST, request.POST ,numresources=num,numfiles=numf)
                    
                if p.is_valid():
                    #add using job queue
                    jobid =add_job(c.userid)

                    for key in p.cleaned_data:
                        #print "key", key
                        #print "value", c.form.cleaned_data[key]
                        newjobinfo = model.jobinfo()
                        newjobinfo.key = key
                        newjobinfo.value = p.cleaned_data[key]
                        newjobinfo.submitted_time = time.asctime()
                        newjobinfo.jobid = jobid
                        add_jobinfo(newjobinfo)

                    redirect(url('/hthpmd/job_table_view?m=1&id=' + str(jobid) ))
                else:
                    c.form = p
                    return render('/jobforms/dyn_namd_form.mako')
            else:
                redirect(url('/hthpmd/job_table_view'))
示例#5
0
    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")
示例#6
0
    def job_insert(self):
        if (c.userid == "false"):
             redirect(url('/users/login?m=1'))

        if request.method == 'POST':

            inftype   = request.POST['inftype']
            infid     = request.POST['infid']
            jobid     = get_jobmeta_jobid(infid)

            if not (inftype == 'resource_type'):
                add_another   = request.POST['add_another']

                print "\n\n\n inftype, add_another", inftype, add_another
            else:
                resource_type = request.POST['resource_type']

            if (inftype == 'ssh_resource'):
               c.form = ssh_resource_Form(request.POST,request.POST )

            elif(inftype == 'gram_resource'):
               c.form = ssh_resource_Form(request.POST,request.POST )

            elif(inftype == 'pbs_resource'):
               c.form = ssh_resource_Form(request.POST,request.POST )

            elif(inftype == 'wu'):
               c.form = wu_Form(request.POST,request.POST )

            else:
               c.form = resource_type_Form(request.POST,request.POST )

            if c.form.is_valid():
                #add using job queue
                for key in c.form.cleaned_data:
                    if (key == "infid") or (key == "jobid")or (key == "someid"):
                        continue
                    add_jobinfo(key,c.form.cleaned_data[key], infid)


                if (inftype == 'resource_type'):
                    redirect(url("/hthpmd/job_form",type="resource",jobid =str(jobid),\
                         rtype=str(resource_type), sid=str(infid)))

                elif (inftype == 'wu'):
                    if add_another == "false":
                        update_job_status(jobid, str(JOBSTATES.NEW))
                        redirect(url("/hthpmd/job_table_view?m=1&id=" + str(jobid)))
                    else:
                        redirect(url("/hthpmd/job_form",type="wu",jobid =str(jobid)  ))
                else:
                    if add_another == "false":
                        redirect(url("/hthpmd/job_form",type="wu",jobid =str(jobid)  ))
                    else:
                        redirect(url("/hthpmd/job_form",type="resource",jobid =str(jobid)  ))

            else:
                return render('/generic_form.mako')
示例#7
0
    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')
示例#8
0
    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')
示例#9
0
    def namd_form(self):
        if (c.userid == "false"):
             redirect(url('/users/login?m=1'))
        #else:
        try:     
           action  = request.params['action']
           num = request.POST["numresources"]
           numf = request.POST["numfiles"]
           print "numf", numf
           c.form  = NAMDForm(request.POST or None, numresources=num,numfiles=numf)
        except:
           c.form  = NAMDForm(request.POST or None)
          

        return render('/jobforms/dyn_namd_form.mako')
示例#10
0
文件: hthpmd.py 项目: Python3pkg/DARE
    def namd_form(self):
        if (c.userid == "false"):
            redirect(url('/users/login?m=1'))
        #else:
        try:
            action = request.params['action']
            num = request.POST["numresources"]
            numf = request.POST["numfiles"]
            print("numf", numf)
            c.form = NAMDForm(request.POST or None,
                              numresources=num,
                              numfiles=numf)
        except:
            c.form = NAMDForm(request.POST or None)

        return render('/jobforms/dyn_namd_form.mako')
示例#11
0
    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')
示例#12
0
    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')
示例#13
0
    def job_form(self):
        if (c.userid == "false"):
             redirect(url('/users/login?m=1'))

        try:
            formtype = request.params['type']
            jobid    = request.params['jobid']
        except:
            jobid    = add_job(c.userid,"Generic Job Form")
            formtype = "resource"


        if  formtype  == "resource":

            try:
                resource_type = request.params['rtype']
                someid = request.params['sid']
                infid = add_jobmeta(jobid, formtype)

                data = {'infid': infid, 'jobid': jobid }

                if (resource_type == "pbs"):
                    c.form = pbs_resource_Form(initial=data)
                elif (resource_type == "gram"):
                    c.form = gram_resource_Form(initial=data)
                else:
                    c.form = ssh_resource_Form(initial=data)

            except:
               pass
               infid = add_jobmeta(jobid, formtype)
               data = {'infid': infid, 'jobid': jobid}
               c.form = resource_type_Form(initial=data)

        elif formtype  == "wu":
             infid = add_jobmeta(jobid, formtype)
             data = {'infid': infid, 'jobid': jobid}

             c.form = wu_Form(initial=data)

        return render('/generic_form.mako')
示例#14
0
文件: hthpmd.py 项目: Python3pkg/DARE
    def job_form(self):
        if (c.userid == "false"):
            redirect(url('/users/login?m=1'))

        try:
            formtype = request.params['type']
            jobid = request.params['jobid']
        except:
            jobid = add_job(c.userid, "Generic Job Form")
            formtype = "resource"

        if formtype == "resource":

            try:
                resource_type = request.params['rtype']
                someid = request.params['sid']
                infid = add_jobmeta(jobid, formtype)

                data = {'infid': infid, 'jobid': jobid}

                if (resource_type == "pbs"):
                    c.form = pbs_resource_Form(initial=data)
                elif (resource_type == "gram"):
                    c.form = gram_resource_Form(initial=data)
                else:
                    c.form = ssh_resource_Form(initial=data)

            except:
                pass
                infid = add_jobmeta(jobid, formtype)
                data = {'infid': infid, 'jobid': jobid}
                c.form = resource_type_Form(initial=data)

        elif formtype == "wu":
            infid = add_jobmeta(jobid, formtype)
            data = {'infid': infid, 'jobid': jobid}

            c.form = wu_Form(initial=data)

        return render('/generic_form.mako')
示例#15
0
    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

        # 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("infopages/job_table_view.mako")
示例#16
0
文件: hthpmd.py 项目: Python3pkg/DARE
    def namd_job_insert(self):
        if (c.userid == "false"):
            redirect(url('/users/login?m=1'))
        else:

            if request.method == 'POST':
                appname = request.POST['appname']
                if (appname == 'namd'):
                    num = request.POST["numresources"]
                    numf = request.POST["numfiles"]

                    p = NAMDForm(request.POST,
                                 request.POST,
                                 numresources=num,
                                 numfiles=numf)

                if p.is_valid():
                    #add using job queue
                    jobid = add_job(c.userid)

                    for key in p.cleaned_data:
                        #print "key", key
                        #print "value", c.form.cleaned_data[key]
                        newjobinfo = model.jobinfo()
                        newjobinfo.key = key
                        newjobinfo.value = p.cleaned_data[key]
                        newjobinfo.submitted_time = time.asctime()
                        newjobinfo.jobid = jobid
                        add_jobinfo(newjobinfo)

                    redirect(url('/hthpmd/job_table_view?m=1&id=' +
                                 str(jobid)))
                else:
                    c.form = p
                    return render('/jobforms/dyn_namd_form.mako')
            else:
                redirect(url('/hthpmd/job_table_view'))
示例#17
0
文件: hthpmd.py 项目: Python3pkg/DARE
    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

        # 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("infopages/job_table_view.mako")
示例#18
0
文件: hthpmd.py 项目: Python3pkg/DARE
 def contact(self):
     return render('/infopages/contact.mako')
示例#19
0
 def software(self):
     return render('/infopages/software.mako')
示例#20
0
文件: hthpmd.py 项目: Python3pkg/DARE
 def resources(self):
     return render('/infopages/resources.mako')
示例#21
0
文件: hthpmd.py 项目: Python3pkg/DARE
 def software(self):
     return render('/infopages/software.mako')
示例#22
0
文件: hthpmd.py 项目: Python3pkg/DARE
 def index(self):
     return render('/infopages/index.mako')
示例#23
0
文件: hthpmd.py 项目: Python3pkg/DARE
 def about(self):
     return render('/infopages/about.mako')
示例#24
0
 def resources(self):
     return render('/infopages/resources.mako')
示例#25
0
文件: hthpmd.py 项目: Python3pkg/DARE
    def job_insert(self):
        if (c.userid == "false"):
            redirect(url('/users/login?m=1'))

        if request.method == 'POST':

            inftype = request.POST['inftype']
            infid = request.POST['infid']
            jobid = get_jobmeta_jobid(infid)

            if not (inftype == 'resource_type'):
                add_another = request.POST['add_another']

                print("\n\n\n inftype, add_another", inftype, add_another)
            else:
                resource_type = request.POST['resource_type']

            if (inftype == 'ssh_resource'):
                c.form = ssh_resource_Form(request.POST, request.POST)

            elif (inftype == 'gram_resource'):
                c.form = ssh_resource_Form(request.POST, request.POST)

            elif (inftype == 'pbs_resource'):
                c.form = ssh_resource_Form(request.POST, request.POST)

            elif (inftype == 'wu'):
                c.form = wu_Form(request.POST, request.POST)

            else:
                c.form = resource_type_Form(request.POST, request.POST)

            if c.form.is_valid():
                #add using job queue
                for key in c.form.cleaned_data:
                    if (key == "infid") or (key == "jobid") or (key
                                                                == "someid"):
                        continue
                    add_jobinfo(key, c.form.cleaned_data[key], infid)

                if (inftype == 'resource_type'):
                    redirect(url("/hthpmd/job_form",type="resource",jobid =str(jobid),\
                         rtype=str(resource_type), sid=str(infid)))

                elif (inftype == 'wu'):
                    if add_another == "false":
                        update_job_status(jobid, str(JOBSTATES.NEW))
                        redirect(
                            url("/hthpmd/job_table_view?m=1&id=" + str(jobid)))
                    else:
                        redirect(
                            url("/hthpmd/job_form",
                                type="wu",
                                jobid=str(jobid)))
                else:
                    if add_another == "false":
                        redirect(
                            url("/hthpmd/job_form",
                                type="wu",
                                jobid=str(jobid)))
                    else:
                        redirect(
                            url("/hthpmd/job_form",
                                type="resource",
                                jobid=str(jobid)))

            else:
                return render('/generic_form.mako')
示例#26
0
 def contact(self):
     return render('/infopages/contact.mako')
示例#27
0
 def old_namd_form(self):
     if (c.userid == "false"):
          redirect(url('/users/login?m=1'))
     c.form = NAMDForm()
     return render('/jobforms/old_namd_form.mako')
示例#28
0
文件: hthpmd.py 项目: Python3pkg/DARE
 def old_namd_form(self):
     if (c.userid == "false"):
         redirect(url('/users/login?m=1'))
     c.form = NAMDForm()
     return render('/jobforms/old_namd_form.mako')
示例#29
0
 def about(self):
     return render('/infopages/about.mako')
示例#30
0
 def index(self):
     return render('/infopages/index.mako')