• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python web.seeother函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中web.seeother函数的典型用法代码示例。如果您正苦于以下问题:Python seeother函数的具体用法?Python seeother怎么用?Python seeother使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了seeother函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: POST

    def POST(self, arg):
        if session.userid != -1:
            raise web.seeother('/')
        i = web.input()
        username = i.get('Username', None)
        password = i.get('Password', None)
        repassword = i.get('RePassword', None)
        email = i.get('Email', None)
        if not password or not repassword or not password == repassword:
            return render.Register("Passwords don't match")
        if not username or not vname.match(username):
            return render.Register('UserName must be between 4 to 50 characters')
        if not vpwd.match(password):
            return render.Register('Password must be more than 4 characters')
        if not email or not vemail.match(email):
            return render.Register('Invaild Email address')

        email = email.lower()
        userid = db.Member.Add(username, password, email)
        if userid:
            session.userid = userid
            session.username = username
            session.gravatar = db.Utility.MD5(email)
            raise web.seeother('/')
        else:
            return render.Register('['+username+'] or ['+email+'] exists')
开发者ID:Lwxiang,项目名称:CoFun,代码行数:26,代码来源:code.py


示例2: GET

    def GET(self):
        global ftoken_db
        i = web.input(author_key=[], language=[], first_publish_year=[], publisher_facet=[], subject_facet=[], person_facet=[], place_facet=[], time_facet=[])
        if i.get('ftokens', None) and ',' not in i.ftokens:
            token = i.ftokens
            if ftoken_db is None:
                ftoken_db = dbm.open('/olsystem/ftokens', 'r')
            if ftoken_db.get(token, None):
                raise web.seeother('/subjects/' + ftoken_db[token].decode('utf-8').lower().replace(' ', '_'))

        self.redirect_if_needed(i)

        if 'isbn' in i and all(not v for k, v in i.items() if k != 'isbn'):
            self.isbn_redirect(i.isbn)

        q_list = []
        q = i.get('q', '').strip()
        if q:
            m = re_olid.match(q)
            if m:
                raise web.seeother('/%s/%s' % (olid_urls[m.group(1)], q))
            m = re_isbn_field.match(q)
            if m:
                self.isbn_redirect(m.group(1))
            q_list.append(q)
        for k in ('title', 'author', 'isbn', 'subject', 'place', 'person', 'publisher'):
            if k in i:
                q_list.append(k + ':' + i[k].replace(':', '\\:').strip())

        return render.work_search(i, ' '.join(q_list), do_search, get_doc)
开发者ID:ziwar,项目名称:openlibrary,代码行数:30,代码来源:code.py


示例3: GET

	def GET(self):
		if not base.logged():
			raise web.seeother('/')
		if web.ctx.session.privilege == 0:
			return base.code("<script language='javascript'>alert('您没有足够的权限,拒绝访问 !');window.history.back(-1);</script>")
		history = models.getHistory()		
		history = list(history)		
		for h in history:
			ltime = time.localtime(int(h['deltime']))
			deltime = time.strftime("%Y-%m-%d %H:%M:%S",ltime)
			h['deltime'] = deltime
		
		input = web.input(action=None,hid=None)

		if not input.action:	
			return render.history(history)
		else:
			# Remove history
			if input.action == 'dh':
				models.delOneHistory(input.hid)
				raise web.seeother('/history')
			# Resotre history
			elif input.action == 'rh':
			 	if models.restoreHistory(input.hid):
					models.delOneHistory(input.hid)
					return base.code("<script language='javascript'>alert('恢复成功 !');window.location.href='/history'; </script>")
				else:
					return base.code("<script language='javascript'>alert('恢复失败,此记录可能已存在,请检查!');window.history.back(-1);</script>")
				
			else:
				return base.code("<script language='javascript'>alert('参数错误 !');window.history.back(-1);</script>")
开发者ID:myisam,项目名称:Lmos,代码行数:31,代码来源:control.py


示例4: POST

    def POST(self):
        web.header('Content-Type', 'text/html')
        f = login_form()
        if not f.validates():
            raise web.seeother('/')

        authOptions = [am for am in web.config.auth.methods if am.can_handle_user(f.d.username)]
        if len(authOptions) == 0:
            raise web.internalerror("No appropriate login method available")

        for ao in authOptions:
            try:
                success, res = ao.login(f.d.username, f.d.password, web.config)
                if success == True:
                    web.config.session.loggedin = True
                    web.config.session.userid = res['userid']
                    web.config.session.userfullname = res['userfullname']
                    web.config.session.userrights = res['rights']
                    raise web.seeother("/")
            except RequireRegistrationException, info:
                web.config.session.showIdentifierRegistration = True
                web.config.session.userid = info.username
                web.config.session.userfullname = info.userfullname
                web.config.session.userrights = "none"
                raise web.seeother('/register')
开发者ID:apanly,项目名称:gitweb.py,代码行数:25,代码来源:login.py


示例5: auth_user

def auth_user(global_config, desired_path='/home'):
    auth = web.ctx.env.get('HTTP_AUTHORIZATION')
    authreq = False
    
    if auth is None:
        authreq = True
    else:
        auth = re.sub('^Basic ','',auth)
        username,password = base64.decodestring(auth).split(':')
        
        if logged_out_users.has_key(username):
            del logged_out_users[username]
        else:
            session = DbSession.open_db_session(global_config['users_db_name'] + global_config['this_season'])
            user = UsersDataModel.getUser(session, username)
            session.remove()
            if user:
                if user.state == 'Disabled':
                    raise web.seeother('/accountdisabled')
                #if (username,password) in allowed:
                if user.check_password(password) == True:
                    raise web.seeother(desired_path)
        authreq = True
    if authreq:
        web.header('WWW-Authenticate','Basic realm="FRC1073 ScoutingAppCentral"')
        web.ctx.status = '401 Unauthorized'
        return
开发者ID:FRCTeam1073-TheForceTeam,项目名称:ScoutingAppCentral,代码行数:27,代码来源:WebLogin.py


示例6: POST

  def POST( self, get_string='' ):
    log.loggit( 'update.POST()' )

    # Must be a matching user or administrator to update
    wputil.must_match_username_or_admin( web.input()['username'] )

    # Catch the cancel button
    if  web.input().has_key('cancel'):
      if wputil.is_admin():
        raise web.seeother('../')
      else:
        raise web.seeother('../../')

    # Validate the form
    if wputil.is_admin():
      f = admin_account_form()
    else:
      f = account_form()
    if not f.validates():
      return { 'status' : 'error',
               'message' : 'Verify all information has been provided correctly.',
               'form' : f }

    # update the account in the database
    adb = accountdb.AccountDB()
    try:
      account = adb.update_account( f.d )
    except:
      return { 'status' : 'error',
               'message' : 'An error occurred updating the account.',
               'form' : f }

    raise web.seeother( '../review/%s' % (account['username']) )
开发者ID:5n1p,项目名称:webpy-example,代码行数:33,代码来源:account_update.py


示例7: GET

	def GET(self):
		userid = web.ctx.session.userid
		if userid:
			raise web.seeother('/show')
			
		else:
			raise web.seeother('/login')
开发者ID:vixiaoan,项目名称:Jask,代码行数:7,代码来源:do.py


示例8: POST

	def POST(self):
		form = web.input(action=None)
		
		if form.action and session.room:
			if '*' in session.room.paths:
				if form.action != session.room.num and form.action not in self.commands:
					session.room.guess -= 1
					session.room.output = "..." % session.room.guess
					if session.room.guess == 0:
						session.room = session.room.go('*')
				elif form.action == session.room.num:
					session.room = session.room.go('x')
			else:
				transition = session.room.go(form.action)
				if transition == None:
					session.room.output = "You cannot do that."
				elif transition != None:
					session.room = transition
				else:
					session.room.output = "Please enter a command."
					
		if form.action in self.commands:
			self.commands[form.action]()
			
		web.seeother('/game')
开发者ID:mariea11,项目名称:git,代码行数:25,代码来源:StartGame.py


示例9: POST

    def POST(self):
        form = login_form()
        if not form.validates():
            return render.login(form=form)
        data = web.input()
        errcode, user = authenticate(data.username, data.password)
        req = web.ctx.req
        if errcode != ERR_OK:
            if errcode == ERR_USER_NOTEXISTS:
                req.err(u'用户未注册')
            elif errcode == ERR_PASSWORD_NOTCORRECT:
                req.err(u'密码错误')

            if 'redirect_to' in data:
                redirect_url = data.redirect_to
            req.update({
                'form': form,
                'redirect_url': redirect_url,
                })
            return render.login(**req)
        auth_login(user)
        redirect_url = data.redirect_to
        if redirect_url:
            raise web.seeother(redirect_url)
        else:
            raise web.seeother('/', True)
开发者ID:FashtimeDotCom,项目名称:pycms,代码行数:26,代码来源:view.py


示例10: GET

    def GET(self):
        # 第一次登陆时如果没有管理员帐号,
        # 则增加一个管理员帐号admin,密码admin,后续可以修改密码
        tips = ""
        u = KeUser.all().filter("name = ", "admin").get()
        if not u:
            myfeeds = Book(title=MY_FEEDS_TITLE, description=MY_FEEDS_DESC, builtin=False, keep_image=True)
            myfeeds.put()
            au = KeUser(
                name="admin",
                passwd=hashlib.md5("admin").hexdigest(),
                kindle_email="",
                enable_send=False,
                send_time=8,
                timezone=TIMEZONE,
                book_type="mobi",
                expires=None,
                ownfeeds=myfeeds,
                oldest_article=7,
            )
            au.put()
            tips = _("Please use admin/admin to login at first time.")
        else:
            tips = _("Please input username and password.")

        if session.login == 1:
            web.seeother(r"/")
        else:
            return self.render("login.html", "Login", tips=tips)
开发者ID:jackyueq,项目名称:KindleEar,代码行数:29,代码来源:main.py


示例11: POST

    def POST(self, _n=None):
        self.login_required()
        name = web.input().get("u")
        if name and (session.username == "admin" or session.username == name):
            u = KeUser.all().filter("name = ", name).get()
            if not u:
                tips = _("The username '%s' not exist!") % name
            else:
                if u.ownfeeds:
                    u.ownfeeds.delete()
                u.delete()

                # 要删掉数据库中订阅记录
                for book in Book.all():
                    if book.users and name in book.users:
                        book.users.remove(name)
                        book.put()

                if session.username == name:
                    raise web.seeother("/logout")
                else:
                    raise web.seeother("/admin")
        else:
            tips = _("The username is empty or you dont have right to delete it!")
        return self.render("delaccount.html", "Delete account", tips=tips, username=name)
开发者ID:jackyueq,项目名称:KindleEar,代码行数:25,代码来源:main.py


示例12: POST

 def POST(self):
     try:
         args = web.input(xlsfile={}) 
     except ValueError:
         return "File too large. Maximum file size is 50MB"
         
     if 'xlsfile' not in args:
         web.seeother('/')
     
     #Cleanup the file path  
     filepath = args.xlsfile.filename.replace('\\','/')
     filename = filepath.split('/')[-1]
     
     if not filename.lower().endswith('xls'):
         raise web.seeother('/?e=Only xls files are accepted')
     
     #Generate a unique folder to store the uploaded file in    
     ID = str(int(random.random()*1000000000000))
     os.mkdir(upload_dir+ID)  
     
     #Store the uploaded xls 
     fout = open(upload_dir+ID+'/'+filename,'w') 
     fout.write(args.xlsfile.file.read())
     fout.close()
     
     #Remove any expired uploads
     self.cleanup_files(upload_dir)
     
     #Convert the file. Report any errors, or offer the id of the
     #folder to download from
     try:
         download_ID = convert.convert(upload_dir +'/'+ID+'/'+filename)
     except:
         raise web.seeother('/?e='+ str(sys.exc_info()[1]))
     raise web.seeother('/?id=' + download_ID)
开发者ID:jbeorse,项目名称:hosting-pyxform,代码行数:35,代码来源:index.py


示例13: _store

    def _store(self, uri, i):
        """
        Store a record
        """
        status = required(i, 'status')
        if status is None:
            return False

        if not self.validstatus.match(status):
            return self._badrequest("Bad value for status: '%s'" % status)

        tags = unpack_tags(getattr(i, 'tags', []))
        pairs = unpack_pairs(getattr(i, 'pairs', {}))
        location = getattr(i, 'location', None)
        known = get_known()
        unknown = get_unknown()

        try:
            u = get_manager().register(
                uri,
                int(status),
                tags = tags,
                pairs = pairs,
                location = location
                )

            known[u.id] = u
            if u.id in unknown:
                del unknown[u.id]

            web.seeother("%s/%s" % (web.ctx.home, u.id))
            return

        except URIError, e:
            return self._badrequest(e)
开发者ID:bekacho,项目名称:urldammit,代码行数:35,代码来源:urldammit.py


示例14: GET

 def GET(self):
     qdict = web.input()
     approve_pwd(qdict)
     if qdict.has_key("rsn") and qdict["rsn"] == "1":
         stop_stations()
         raise web.seeother("/")
         return
     if qdict.has_key("en") and qdict["en"] == "":
         qdict["en"] = "1"  # default
     elif qdict.has_key("en") and qdict["en"] == "0":
         gv.srvals = [0] * (gv.sd["nst"])  # turn off all stations
         set_output()
     if qdict.has_key("mm") and qdict["mm"] == "0":
         clear_mm()
     if qdict.has_key("rd") and qdict["rd"] != "0" and qdict["rd"] != "":
         gv.sd["rdst"] = gv.now + (int(qdict["rd"]) * 3600)
         stop_onrain()
     elif qdict.has_key("rd") and qdict["rd"] == "0":
         gv.sd["rdst"] = 0
     if qdict.has_key("rbt") and qdict["rbt"] == "1":
         jsave(gv.sd, "sd")
         gv.srvals = [0] * (gv.sd["nst"])
         set_output()
         os.system("reboot")
         raise web.seeother("/")
     for key in qdict.keys():
         try:
             gv.sd[key] = int(qdict[key])
         except:
             pass
     jsave(gv.sd, "sd")
     raise web.seeother("/")  # Send browser back to home page
     return
开发者ID:jgoldin9083,项目名称:OSPi,代码行数:33,代码来源:ospi.py


示例15: profile

    def profile(self, domain, mail, accountType='user'):
        self.mail = web.safestr(mail)
        self.domain = self.mail.split('@', 1)[-1]

        if self.domain != domain:
            return web.seeother('/domains?msg=PERMISSION_DENIED')

        self.filter = '(&(objectClass=mailUser)(mail=%s))' % (self.mail,)
        if accountType == 'catchall':
            self.filter = '(&(objectClass=mailUser)([email protected]%s))' % (self.mail,)
        else:
            if not self.mail.endswith('@' + self.domain):
                return web.seeother('/domains?msg=PERMISSION_DENIED')

        if attrs.RDN_USER == 'mail':
            self.searchdn = ldaputils.convKeywordToDN(self.mail, accountType=accountType)
            self.scope = ldap.SCOPE_BASE
        else:
            self.searchdn = attrs.DN_BETWEEN_USER_AND_DOMAIN + ldaputils.convKeywordToDN(self.domain, accountType='domain')
            self.scope = ldap.SCOPE_SUBTREE

        try:
            self.user_profile = self.conn.search_s(
                self.searchdn,
                self.scope,
                self.filter,
                attrs.USER_ATTRS_ALL,
            )
            return (True, self.user_profile)
        except Exception, e:
            return (False, ldaputils.getExceptionDesc(e))
开发者ID:FlorianHeigl,项目名称:iredmail.iredadmin,代码行数:31,代码来源:user.py


示例16: GET

 def GET(self):
     # 第一次登陆时如果没有管理员帐号,
     # 则增加一个管理员帐号admin,密码admin,后续可以修改密码
     tips = ''
     u = KeUser.all().filter("name = ", 'admin').get()
     if not u:
         myfeeds = Book(title=MY_FEEDS_TITLE,description=MY_FEEDS_DESC,
                 builtin=False,keep_image=True)
         myfeeds.put()
         au = KeUser(name='admin',passwd=hashlib.md5('admin').hexdigest())
         au.kindle_email = ''
         au.enable_send = False
         au.send_time = 8
         au.timezone = TIMEZONE
         au.book_type = "mobi"
         au.expires = None
         au.ownfeeds = myfeeds
         au.put()
         tips = u"初次登陆请使用用户名'admin'/密码'admin'登陆。 "
     else:
         tips = u"请输入正确的用户名和密码登陆进入系统。 "
     
     if session.login == 1:
         web.seeother(r'/')
     else:
         return jjenv.get_template("login.html").render(nickname='',title='Login',tips=tips)
开发者ID:chenmsster,项目名称:KindleEar,代码行数:26,代码来源:main.py


示例17: POST

  def POST( self, get_string='' ):
    log.loggit( 'delete.POST()' )

    # Catch the cancel button
    if  web.input().has_key('cancel'):
      raise web.seeother('../')

    # Validate the form
    f = delete_confirmation_form()
    if not f.validates():
      return { 'status' : 'error',
               'message' : 'Verify all information has been provided correctly.',
               'form' : f }

    if f.d['username'] == 'admin':
      return { 'status' : 'error',
               'message' : 'You cannot delete the administration account.' }

    # update the account in the database
    adb = accountdb.AccountDB();
    try:
      row = adb.delete_account( f.d['username'] )
    except:
      return { 'status' : 'error',
               'message' : 'An error occurred deleting the account.' }

    raise web.seeother('../')
开发者ID:LiboMa,项目名称:webpy-example,代码行数:27,代码来源:account_delete.py


示例18: results_post

def results_post(session):
    form = web.input().group
    if form is not None:
        session.studid = form
        raise web.seeother('/studedit/' + session.studid)
        #raise web.seeother('/cart')
    raise web.seeother('/search')
开发者ID:vicnala,项目名称:ampabooks,代码行数:7,代码来源:view.py


示例19: GET

	def GET(self):
		data = web.input()
		contype = data['type']
		content = data['content']
		if contype=="tvshow":
			tvopen = open(tvfile,"a")
			tvread = tvopen.write(content+"\n")
			tvopen.close()
			tvShowSearchWeb()
			raise web.seeother('/')
		elif contype=="movie":
			movieopen = open(moviefile,"a")
			movieread = movieopen.write(content+"\n")
			movieopen.close()
			movieSearchWeb()
			raise web.seeother('/')
		elif contype=="music":
			musicopen = open(musicfile,"a")
			musicread = musicopen.write(content+"\n")
			musicopen.close()
			musicSearchWeb()
			raise web.seeother('/')
		elif contype=="picture":
			pictureopen = open(picturefile,"a")
			pictureread = pictureopen.write(content+"\n")
			pictureopen.close()
			photoSearchWeb()
			raise web.seeother('/')
开发者ID:R3KHYT,项目名称:PlexDownloader,代码行数:28,代码来源:webui.py


示例20: POST

 def POST(self, chid):
     userid = web.config.db.select(
         'channels', what='user', where='id = $ch',
         vars={'ch': int(chid)})[0]['user']
     web.config.db.delete(
         'readed', where='channel = $ch', vars={'ch': int(chid)})
     web.seeother('/user/%d' % userid)
开发者ID:yegle,项目名称:cves,代码行数:7,代码来源:mgr.py



注:本文中的web.seeother函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python web.select函数代码示例发布时间:2022-05-26
下一篇:
Python web.safeunicode函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap