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

Python session.delete函数代码示例

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

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



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

示例1: delete

 def delete(self, parameters):
     session = meta.Session()
     deleteCount = 1
     jdata = json.loads(parameters)
     ids = []
     for key, value in jdata.iteritems():
         if key == 'deleteId':
             my_splitter = shlex.shlex(value, posix=True)
             my_splitter.whitespace += ','
             my_splitter.whitespace_split = True
             ids = list(my_splitter)
             break
     for id in ids:
         id = id.replace("\0", "")
         if id:
             id = int(id)
             resourceObj = meta.Session.query(Resource).filter(Resource.id == id).first()
             session.delete(resourceObj)
             if app_globals.available_resources.has_key(resourceObj.hostname):
                 del(app_globals.available_resources[resourceObj.hostname])
             deleteCount = deleteCount + 1
     
     session.commit()
     
     return '{"message":"%d records deleted"}' % deleteCount
开发者ID:sumukh210991,项目名称:Cyberweb,代码行数:25,代码来源:resourcename.py


示例2: __call__

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        try:
            res = WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()

        for cookie in request.cookies:
            # Remove the ckan session cookie if not used e.g. logged out
            if cookie == "ckan" and not c.user:
                # Check session for valid data (including flash messages)
                # (DGU also uses session for a shopping basket-type behaviour)
                is_valid_cookie_data = False
                for key, value in session.items():
                    if not key.startswith("_") and value:
                        is_valid_cookie_data = True
                        break
                if not is_valid_cookie_data:
                    if session.id:
                        self.log.debug("No valid session data - " "deleting session")
                        self.log.debug("Session: %r", session.items())
                        session.delete()
                    else:
                        self.log.debug("No session id - " "deleting session cookie")
                        response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == "auth_tkt" and not session.id:
                response.delete_cookie(cookie)

        return res
开发者ID:Fiware,项目名称:context.Ckan,代码行数:34,代码来源:base.py


示例3: delete

    def delete(self, parameters):
        deleteCount = 1
        session = meta.Session()
        jdata = json.loads(parameters)
        ids = []
        for key, value in jdata.iteritems():
            if key == 'deleteId':
                my_splitter = shlex.shlex(value, posix=True)
                my_splitter.whitespace += ','
                my_splitter.whitespace_split = True
                ids = list(my_splitter)
                break
        for id in ids:
            id = id.replace("\0", "")
            if id:
                id = int(id)
                accountObj = meta.Session.query(Account).filter(Account.id == id).one()
                accountObj.active = 0
                session.commit()
                self.jodis_connect(accountObj.id)
                session.delete(accountObj)
                deleteCount = deleteCount + 1

        session.commit()
        #meta.Session.close()

        return '{"message":"%d records deleted"}' % deleteCount
开发者ID:sumukh210991,项目名称:Cyberweb,代码行数:27,代码来源:account.py


示例4: __call__

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith("ckan") and cookie not in ["ckan"]:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == "ckan" and not c.user and not h.are_there_flash_messages():
                if session.id:
                    if not session.get("lang"):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == "auth_tkt" and not session.id:
                response.delete_cookie(cookie)

        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
开发者ID:gitter-badger,项目名称:ckan,代码行数:28,代码来源:base.py


示例5: _clearSession

 def _clearSession(self):
   if not self.uid is None:
     session['uid'] = None
     del(session['uid'])
     session.invalidate()
     session.save()
     session.delete()
开发者ID:sim0nx,项目名称:voteX,代码行数:7,代码来源:poll.py


示例6: logged_out

 def logged_out(self):
     log.fatal("logged out")
     # we need to get our language info back and the show the correct page
     lang = session.get('lang')
     c.user = None
     session.delete()
     h.redirect_to(locale=lang, controller='ckanext.dgvat_por.controllers.dgvat_user:DgvatUserController', action='logged_out_page')    
开发者ID:datagvat,项目名称:ckanext-dgvat_por,代码行数:7,代码来源:dgvat_user.py


示例7: logout

    def logout(self):
        """ Log out the user and display a confirmation message.
        """

        # remove session
        session.delete()

        return render('login.html')
开发者ID:hetznerZA,项目名称:NIPAP,代码行数:8,代码来源:auth.py


示例8: logout

    def logout(self):
        """Logout user by deleting the session.

        :URL: ``POST /login/logout``.
        :returns: ``{"authenticated": False}``.

        """
        session.delete()
        return {'authenticated': False}
开发者ID:FieldDB,项目名称:old,代码行数:9,代码来源:login.py


示例9: post_login

 def post_login(self):
     if c.user:
         url = h.base_url(c.instance)
         if 'came_from' in session:
             url = session.get('came_from')
             del session['came_from']
             session.save()
         h.flash(_("You have successfully logged in."), 'success')
         redirect(str(url))
     else:
         session.delete()
         return formencode.htmlfill.render(
             render("/user/login.html"),
             errors={"login": _("Invalid user name or password")})
开发者ID:AnonOnWarpath,项目名称:adhocracy,代码行数:14,代码来源:user.py


示例10: current_user

def current_user():
    from ututi.model import User
    try:
        login = session.get('login', None)
        if login is None:
            return None
        login = int(login)
    except ValueError:
        return None

    session_secret = session.get('cookie_secret', None)
    cookie_secret = request.cookies.get('ututi_session_lifetime', None)

    if session_secret != cookie_secret:
        session.delete()
        response.delete_cookie('ututi_session_lifetime')
        return None

    return User.get_byid(login)
开发者ID:nous-consulting,项目名称:ututi,代码行数:19,代码来源:security.py


示例11: __call__

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        try:
            res = WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()

        # Clean out any old cookies as they may contain api keys etc
        # This also improves the cachability of our pages as cookies
        # prevent proxy servers from caching content unless they have
        # been configured to ignore them.
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan']:
                response.delete_cookie(cookie)
            # Remove the ckan session cookie if not used e.g. logged out
            elif cookie == 'ckan' and not c.user:
                # Check session for valid data (including flash messages)
                # (DGU also uses session for a shopping basket-type behaviour)
                is_valid_cookie_data = False
                for key, value in session.items():
                    if not key.startswith('_') and value:
                        is_valid_cookie_data = True
                        break
                if not is_valid_cookie_data:
                    if session.id:
                        if not session.get('lang'):
                            self.log.debug('No session data any more - '
                                           'deleting session')
                            self.log.debug('Session: %r', session.items())
                            session.delete()
                    else:
                        response.delete_cookie(cookie)
                        self.log.debug('No session data any more - '
                                       'deleting session cookie')
            # Remove auth_tkt repoze.who cookie if user not logged in.
            elif cookie == 'auth_tkt' and not session.id:
                response.delete_cookie(cookie)

        return res
开发者ID:eGT-Labs,项目名称:GeoCloud-CKAN,代码行数:43,代码来源:base.py


示例12: delete_player

    def delete_player(self):
        session = Session()
        id = self.form_result['id']
        first = self.form_result['first']
        last = self.form_result['last']
        position = self.form_result['position']

        players = session.query(Player).filter_by(id=id,
                first=first,
                last=last,
                position=position).all()
        if len(players) <> 1:
            h.flash("The player was modified by someone else while you were staring at the screen!")
        else:
            player = players[0]
            session.delete(player)
            session.commit()
            h.flash("Player %s was deleted" % player.id)

        return h.redirect_to(controller='roster')
开发者ID:jython,项目名称:book,代码行数:20,代码来源:roster.py


示例13: __call__

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # WSGIController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # clean out any old cookies as they may contain api keys etc
        for cookie in request.cookies:
            if cookie.startswith('ckan') and cookie not in ['ckan', 'ckan_killtopbar']:
                response.delete_cookie(cookie)

            if cookie == 'ckan' and not c.user and not h.are_there_flash_messages():
                if session.id:
                    if not session.get('lang'):
                        session.delete()
                else:
                    response.delete_cookie(cookie)
        try:
            return WSGIController.__call__(self, environ, start_response)
        finally:
            model.Session.remove()
开发者ID:allanglen,项目名称:ckan,代码行数:21,代码来源:base.py


示例14: delete

 def delete(self, parameters):
     session = meta.Session()
     deleteCount = 1
     jdata = json.loads(parameters)
     ids = []
     for key, value in jdata.iteritems():
         if key == 'deleteId':
             my_splitter = shlex.shlex(value, posix=True)
             my_splitter.whitespace += ','
             my_splitter.whitespace_split = True
             ids = list(my_splitter)
             break
     for id in ids:
         id = id.replace("\0", "")
         if id:
             id = int(id)
             queueTypeObj = meta.Session.query(QueueType).filter(QueueType.id == id).first()
             session.delete(queueTypeObj)
             deleteCount = deleteCount + 1
     
     session.commit()
     
     return '{"message":"%d records deleted"}' % deleteCount
开发者ID:sumukh210991,项目名称:Cyberweb,代码行数:23,代码来源:queuetype.py


示例15: process

 def process(self):
     """Handle incoming redirect from OpenID Provider"""
     end_action = session.get('openid_action', 'login')
     
     oidconsumer = consumer.Consumer(self.openid_session, app_globals.openid_store)
     info = oidconsumer.complete(request.params, url('openid_process', qualified=True))
     if info.status == consumer.FAILURE and info.identity_url:
         fmt = "Verification of %s failed: %s"
         failure_flash(fmt % (info.identity_url, info.message))
     elif info.status == consumer.SUCCESS:
         openid_identity = info.identity_url
         if info.endpoint.canonicalID:
             # If it's an i-name, use the canonicalID as its secure even if
             # the old one is compromised
             openid_identity = info.endpoint.canonicalID
         
         # We've now verified a successful OpenID login, time to determine
         # how to dispatch it
         
         # First save their identity in the session, as several pages use 
         # this data
         session['openid_identity'] = openid_identity
         
         # Save off the session
         session.save()
         
         # First, if someone already has this openid, we log them in if
         # they've verified their email, otherwise we inform them to verify
         # their email address first
         users = list(Human.by_openid(self.db)[openid_identity])
         if users:
             user = users[0]
             if user.email_token:
                 failure_flash('You must verify your email before signing in.')
                 redirect(url('account_login'))
             else:
                 user.process_login()
                 success_flash('You have logged into PylonsHQ')
                 if session.get('redirect'):
                     redir_url = session.pop('redirect')
                     session.save()
                     redirect(url(redir_url))
                 redirect(url('home'))
         
         # Second, if this is a registration request, present the rest of
         # registration process
         if session.get('openid_action', '') == 'register':
             sreg_response = sreg.SRegResponse.fromSuccessResponse(info)
             results = {}
             
             # Just in case the user didn't provide sreg details
             if sreg_response:
                 results['displayname'] = sreg_response.get('fullname')
                 results['timezone'] = sreg_response.get('timezone')
                 results['email_address'] = sreg_response.get('email')
             c.defaults = results
             c.openid = openid_identity
             return render('/accounts/register.mako')
         
         # The last option possible, is that the user is associating this
         # OpenID account with an existing account
         c.openid = openid_identity
         return render('/accounts/associate.mako')
     elif info.status == consumer.CANCEL:
         failure_flash('Verification cancelled')
     elif info.status == consumer.SETUP_NEEDED:
         if info.setup_url:
             c.message = '<a href=%s>Setup needed</a>' % info.setup_url
         else:
             # This means auth didn't succeed, but you're welcome to try
             # non-immediate mode.
             failure_flash('Setup needed')
     else:
         failure_flash('Verification failed.')
     session.delete()
     proper_abort(end_action)
开发者ID:Pylons,项目名称:kai,代码行数:76,代码来源:consumer.py


示例16: UserLogout

def UserLogout():
    session.delete()
开发者ID:nint22,项目名称:CoreCodex,代码行数:2,代码来源:Users.py


示例17: logout

 def logout(self):
     session.delete()
     log.info('Logging out and deleting session for user')
     redirect(url('home'))
开发者ID:greenboxindonesia,项目名称:rhodecode,代码行数:4,代码来源:login.py


示例18: logged_out

 def logged_out(self):
     # we need to get our language info back and the show the correct page
     lang = session.get('lang')
     c.user = None
     session.delete()
     h.redirect_to(locale=lang, controller='user', action='logged_out_page')
开发者ID:Lennaron,项目名称:ckan,代码行数:6,代码来源:user.py


示例19: sign_out

 def sign_out(self):
     session["user"] = None
     session.delete()
     h.flash("You have been logged out.")
     redirect('/')
开发者ID:svarks,项目名称:bind_config_manager,代码行数:5,代码来源:auth.py


示例20: post_logout

 def post_logout(self):
     session.delete()
     redirect(h.base_url())
开发者ID:aoeztuerk,项目名称:adhocracy,代码行数:3,代码来源:user.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python session.get函数代码示例发布时间:2022-05-25
下一篇:
Python response.set_cookie函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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