当前位置: 首页>>代码示例>>Python>>正文


Python SessionManager.get方法代码示例

本文整理汇总了Python中pycket.session.SessionManager.get方法的典型用法代码示例。如果您正苦于以下问题:Python SessionManager.get方法的具体用法?Python SessionManager.get怎么用?Python SessionManager.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pycket.session.SessionManager的用法示例。


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

示例1: keeps_previous_items_when_setting_new_ones

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def keeps_previous_items_when_setting_new_ones(self):
        handler = StubHandler()
        manager = SessionManager(handler)

        manager.set('some-object', {'foo': 'bar'})
        manager.set('some-object2', {'foo2': 'bar2'})

        self.assertEqual(manager.get('some-object')['foo'], 'bar')
        self.assertEqual(manager.get('some-object2')['foo2'], 'bar2')
开发者ID:Mondego,项目名称:pyreco,代码行数:11,代码来源:allPythonContent.py

示例2: get

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
 def get(cls, handler, name):
     session = SessionManager(handler)
     Debug.dprint(text='name: ' + name, type='custom')
     Debug.dprint(text='value: ' + str(session.get(name)), type='error')
     # print "Session name is: " + name
     # print "Do we have a session? " + str(session.get(name))
     # if cls.exists(handler, name):
     #     print "There is a session"
     # else:
     #     print "There is not any sessionn"
     return session.get(name)
开发者ID:ehsansh84,项目名称:Customs,代码行数:13,代码来源:session2.py

示例3: get

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
 def get(self, *args, **kwargs):
     # redis_instance.set(name='name', value='EHSAN')
     # self.write(redis_instance.get(name='name'))
     session = SessionManager(self)
     # session.set('key', 'OMG')
     session.set(name='key', value='OMG')
     # session['key'] = 'OMG'
     self.write(session.get(self, 'key'))
     self.write(str(session.get('key')))
     # self.write(str(session.keys()))
     self.write(str(session.iterkeys()))
     # self.write(session['key'])
     self.write('done')
开发者ID:ehsansh84,项目名称:Customs,代码行数:15,代码来源:test.py

示例4: retrieves_session_with_same_data_as_saved

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def retrieves_session_with_same_data_as_saved(self):
        handler = StubHandler()
        manager = SessionManager(handler)

        manager.set('some-object', {'foo': 'bar'})

        self.assertEqual(manager.get('some-object')['foo'], 'bar')
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py

示例5: gets_default_value_if_provided_and_not_in_client

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def gets_default_value_if_provided_and_not_in_client(self):
        handler = StubHandler()
        manager = SessionManager(handler)

        value = manager.get('foo', 'Default')

        self.assertEqual(value, 'Default')
开发者ID:Mondego,项目名称:pyreco,代码行数:9,代码来源:allPythonContent.py

示例6: get

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def get(self):
        sessionid = self.get_current_session()
        logging.debug("LoginHandler: sessionid %s" % sessionid)
        session = SessionManager(self)

        tpl_fields = TemplateFields()
        tpl_fields['post'] = False
        tpl_fields['server'] = session.get('server')
        tpl_fields['username'] = session.get('user')

        # using the next field makes it easier across logins
        tpl_fields['next'] = self.get_argument('next', '/')
        logging.debug("LoginHandler: next: %s" % tpl_fields['next'])

        logging.debug('LoginHandler: login page about to be rendered')
        self.render("login.html", fields=tpl_fields)
开发者ID:ytjohn,项目名称:rondurev,代码行数:18,代码来源:views.py

示例7: get

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
 def get(self):
     session = SessionManager(self)
     k = session.get('catId')
     if k != None:
         self.render("login.html")
     else:
         self.redirect('/indexihtml')
开发者ID:LinkBook,项目名称:Tornado,代码行数:9,代码来源:application.py

示例8: deletes_item_using_command

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def deletes_item_using_command(self):
        handler = StubHandler()
        manager = SessionManager(handler)

        manager.set('some-object', {'foo': 'bar'})

        del manager['some-object']

        self.assertIsNone(manager.get('some-object'))
开发者ID:Mondego,项目名称:pyreco,代码行数:11,代码来源:allPythonContent.py

示例9: still_retrieves_object_if_not_passed_from_expiration

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def still_retrieves_object_if_not_passed_from_expiration(self):
        handler = StubHandler()
        manager = SessionManager(handler)

        manager.set('foo', 'bar')

        time.sleep(1)

        self.assertEqual(manager.get('foo'), 'bar')
开发者ID:Mondego,项目名称:pyreco,代码行数:11,代码来源:allPythonContent.py

示例10: cannot_retrieve_object_if_passed_from_expiration

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def cannot_retrieve_object_if_passed_from_expiration(self):
        handler = StubHandler()
        manager = SessionManager(handler)
        manager.driver.EXPIRE_SECONDS = 1

        manager.set('foo', 'bar')

        time.sleep(manager.driver.EXPIRE_SECONDS + 1)

        self.assertIsNone(manager.get('foo'))
开发者ID:Mondego,项目名称:pyreco,代码行数:12,代码来源:allPythonContent.py

示例11: exists

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
 def exists(cls, handler, name):
     session = SessionManager(handler)
     # print "Inside exist: " + name + ' ' + str(session.get(name))
     return session.get(name) != None
开发者ID:ehsansh84,项目名称:Customs,代码行数:6,代码来源:session2.py

示例12: retrieves_none_if_session_object_not_previously_set

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def retrieves_none_if_session_object_not_previously_set(self):
        handler = StubHandler()
        manager = SessionManager(handler)

        self.assertIsNone(manager.get('unexistant-object'))
开发者ID:Mondego,项目名称:pyreco,代码行数:7,代码来源:allPythonContent.py

示例13: TornadoRequestBase

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
class TornadoRequestBase(tornado.web.RequestHandler):
    def __init__(self, application, request, **kwargs):
        super(TornadoRequestBase, self).__init__(application, request, **kwargs)

        self.session = SessionManager(self)

        self.user = {
            "name": self.session.get('name', None),
            "user": self.session.get('user', None),
            "id": self.session.get('id', None),
            "picture_address": self.session.get('picture_address', None),
            "id_admin": self.session.get('id_admin', None),
            "type_user": self.session.get('type_user', None),
            "online": self.session.get('online', None),
            "password": self.session.get('password', None),
            "email": self.session.get('email', None),
            "message": self.session.get('message', None),
            "count_message": self.session.get('count_message', None)


        }

    def get_current_user(self):
        return self.session.get('online')
开发者ID:hhosseinid,项目名称:StudentExpenses,代码行数:26,代码来源:index_handler.py

示例14: post

# 需要导入模块: from pycket.session import SessionManager [as 别名]
# 或者: from pycket.session.SessionManager import get [as 别名]
    def post(self):
        session = SessionManager(self)
        # if session.get()
        noun1 = self.get_argument('noun1')
        noun2 = self.get_argument('noun2')
        verb = self.get_argument('verb')
        noun3 = self.get_argument('noun3')
        us = self.get_current_user()

        self.render('poem.html', roads=noun1, wood=noun2, made=verb,difference=noun3,user = us,ID=session.get('_id'),INFO=session.get('info'))
开发者ID:msajadi832,项目名称:Tornado,代码行数:12,代码来源:start.py


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