示例#1
0
文件: User.py 项目: holdlg/helper
 def POST(self):
     loginFrom_data = web.input()
     account = loginFrom_data.get('account')
     password = loginFrom_data.get("password")
     PyMongoEngine().connectionMongo();
     login_user = User.objects(name=account)
     web.config._session.login_user = login_user[0]
     print web.config._session.login_user.description
     if login_user[0].password == HelperMd5().helperMd5(password):
         load_page = engine.render(':login',{'title':'login'})  
         return load_page
示例#2
0
文件: Test.py 项目: holdlg/helper
#!usr/bin/python
#-*- coding:utf-8
'''
Created on 2014年3月10日

@author: holdlg
'''
import hashlib
from ws.Entity import User
from ws.Tool import PyMongoEngine

if __name__ == '__main__':
    hmd5 = hashlib.md5()
    new_user = User()
    new_user.name = 'helpp'
    new_user.email = '*****@*****.**'
    hmd5.update('helpp');
    new_user.password = hmd5.hexdigest()
    new_user.image = 'helpp.jpg'
    new_user.description = '我是一个粉刷将匠helpp。'
    
    PyMongoEngine().connectionMongo()
    new_user.save()
    
    
    for user in User.objects(name='helpp'):
        print user.name,user.password,user.email,user.image,user.description,user.join_time