Ejemplo n.º 1
0
    def get(self):

    	#self.write(mongosion.get(self.session_id))
		self.write('<html><body><h4>save a session </h4>')
		data = mongosion.save( self.data['_id'], {'uid':'123', 'name':'YaoHomeway', 'status':'forbidden'})

		self.write('<h4>result :</h4>')
		self.write(data)
		self.write('<h4>delete a session </h4>')

		flag = mongosion.delete(data['_id'])

		self.write('<h4>delete successfully</h4><body></html>')
Ejemplo n.º 2
0
    def get(self):

        #self.write(mongosion.get(self.session_id))
        self.write('<html><body><h4>save a session </h4>')
        data = mongosion.save(self.data['_id'], {
            'uid': '123',
            'name': 'YaoHomeway',
            'status': 'forbidden'
        })

        self.write('<h4>result :</h4>')
        self.write(data)
        self.write('<h4>delete a session </h4>')

        flag = mongosion.delete(data['_id'])

        self.write('<h4>delete successfully</h4><body></html>')
Ejemplo n.º 3
0
import mongosion

test():
	print 'make sure pymongo has installed and mongodb is running'

	# get session ( if null, create it )
	data = mongosion.get('session_id')
	# save session
	mongosion.save( data['_id'], { 'uid':'user id', 'status':'forbidden', 'isLogin':False })
	# delete expired
	mongosion.expired()

	if mongosion.exist( session_id ):
		print session_id + ' session is exist!'	
	else:
		print session_id + ' not exist'

test()