예제 #1
0
def check_time():
    start_time = datetime.datetime(2015, 4, 15, hour=9)
    end_time = datetime.datetime(2015, 4, 15, hour=17)
    now = datetime.datetime.now()
    if now < start_time:
        return render.l12(page=u"学生观摩注册平台将于4月15日 9:00-17:00 对外开放。")
    elif now > end_time:
        return render.l12(page=u"申请时间已过。")
    return False
예제 #2
0
def check_time():
    start_time = datetime.datetime(2015,4,15,hour=9)
    end_time = datetime.datetime(2015,4,15,hour=17)
    now = datetime.datetime.now()
    if now < start_time:
        return render.l12( page = u"学生观摩注册平台将于4月15日 9:00-17:00 对外开放。")
    elif now > end_time:
        return render.l12( page = u"申请时间已过。" )
    return False
예제 #3
0
 def POST(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     ipt = web.input(_unicode=True)
     f = mww.MyForm(self.registration_form(),'/cumt/Application')
     if not f.form.validates(ipt):
         p = mww.Panel('Application',f.render_css())
         return render.l12( page = p.render())
     regid = users.add_reg(session.get_session().uid,f.form.d)
     p = mww.Panel(u'提交申请',u'申请已提交,点击<a href="/cumt/Application">这里</a>进行修改')
     return render.l12( page = p.render())
예제 #4
0
 def POST(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     ipt = web.input(_unicode=True)
     f = mww.MyForm(self.registration_form(), '/cumt/Application')
     if not f.form.validates(ipt):
         p = mww.Panel('Application', f.render_css())
         return render.l12(page=p.render())
     regid = users.add_reg(session.get_session().uid, f.form.d)
     p = mww.Panel(u'提交申请',
                   u'申请已提交,点击<a href="/cumt/Application">这里</a>进行修改')
     return render.l12(page=p.render())
예제 #5
0
 def GET(self):
     if session.get_session().privilege != 0:
         # already login
         raise web.seeother('/cumt/Profile')
     form = mww.MyForm(self.login_form(), '/cumt/Login')
     r = mww.Panel('Login', form.render_css()).render()
     return render.l12(page=r)
예제 #6
0
 def GET(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     f = mww.MyForm(self.registration_form(),'/cumt/Application')
     user = users.get_user_by_uid(session.get_session().uid)
     f.form.fill(user)
     p = mww.Panel(u'提交申请',f.render_css())
     return render.l12( page = p.render())
예제 #7
0
 def GET(self):
     if session.get_session().privilege != 1:
         raise web.seeother('/cumt/ApplicationRoute')
     result = check_time()
     if result:
         return result
     f = mww.MyForm(self.registration_form(), '/cumt/Application')
     user = users.get_user_by_uid(session.get_session().uid)
     f.form.fill(user)
     p = mww.Panel(u'提交申请', f.render_css())
     return render.l12(page=p.render())
예제 #8
0
 def POST(self):
     f = mww.MyForm(self.login_form(), '/cumt/Login')
     ipt = web.input(_unicode=False)
     if not f.form.validates(ipt):
         # show = ipt.get('show','all')
         show = web.input(show='all').show
         r = mww.Panel('Login', f.render_css()).render()
         return render.l12(page=r)
     else:
         session.login(f.form.d.email)
         raise web.seeother('/cumt/SendApplication')
예제 #9
0
 def POST(self):
     f = mww.MyForm(self.register_form(), '/cumt/SignUp')
     ipt = web.input(_unicode=True)
     if not f.form.validates(ipt):
         show = web.input(show='all').show
         r = mww.Panel(u'注册', f.render_css()).render()
         return render.l12(page=r)
     else:
         users.create_account(email=f.form.d.email,
                              password=f.form.d.password,
                              privilege=1)
         session.login(f.form.d.email)
         raise web.seeother('/cumt/SendApplication')
예제 #10
0
 def GET(self):
     ipt = web.input()
     if not 'name' in ipt:
         return "GET Request Format error"
     if not articles.name_exist_p(ipt.name):
         return "%s Page not exist" % ipt.name
     a = articles.get_article_by_name(ipt.name)
     if a.content.startswith('URL:'):
         raise web.seeother(a.content[4:])
     elif a.parent == "NOPARENT":
         return render.l12(page=a.content)
     else:
         parent = articles.get_article_by_name(a.parent)
         #TODO: use hash table, instead of liner look up table
         for p in web.config._title_list:
             if p.name == a.parent:
                 break
         left_links = map(lambda x: ["Article?name=" + x.name, x.title],
                          p.child)
         s = mww.ListGroup(left_links).render()
         l = mww.Panel(parent.title, None, s)
         r = mww.Panel(a.title, a.content)
         return render.l3r9(left=l.render(), right=r.render())
예제 #11
0
 def GET(self):
     ipt = web.input()
     if not 'name' in ipt:
         return "GET Request Format error"
     if not articles.name_exist_p(ipt.name):
         return "%s Page not exist" % ipt.name
     a = articles.get_article_by_name(ipt.name)
     if a.content.startswith('URL:'):
         raise web.seeother(a.content[4:])
     elif a.parent == "NOPARENT":
         return render.l12(page = a.content)
     else:
         parent = articles.get_article_by_name(a.parent)
         #TODO: use hash table, instead of liner look up table
         for p in web.config._title_list:
             if p.name == a.parent:
                 break
         left_links = map(lambda x:["Article?name="+x.name,x.title],
                          p.child)
         s = mww.ListGroup(left_links).render()
         l = mww.Panel(parent.title,None,s)
         r = mww.Panel(a.title,a.content)
         return render.l3r9(left=l.render(),right=r.render())