本文整理汇总了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')
示例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)
示例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')
示例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')
示例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')
示例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)
示例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')
示例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'))
示例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')
示例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'))
示例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
示例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'))
示例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')
示例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'))