Ejemplo n.º 1
0
def createsession():
	print 'createsession'
	db = myutil.db
	if db is None:
		print 'db error'

	sessiondb = web.session.DBStore(db, 'sessions')
	session = web.session.Session(app, sessiondb,
			initializer={"privilege": -1, 
				"authcode": pic.picChecker().getPicString()})
	def session_hook():
		web.ctx.session = session
	app.add_processor(web.loadhook(session_hook))
Ejemplo n.º 2
0
def createsession():
	if web.config.get('_session'):
		return web.config._session
	sqlitedb = web.database(dbn='mysql', 
			user='******', 
			pw='webadmin791127', 
			host='localhost', 
			db='myblog')

	sessiondb = web.session.DBStore(sqlitedb, 'sessions')
	session = web.session.Session(app, sessiondb,
			initializer={"privilege": -1, 
				"authcode": pic.picChecker().getPicString()})
	web.config["_session"] = session