本文整理匯總了Python中DoctorSpring.models.User.update方法的典型用法代碼示例。如果您正苦於以下問題:Python User.update方法的具體用法?Python User.update怎麽用?Python User.update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DoctorSpring.models.User
的用法示例。
在下文中一共展示了User.update方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: updateAcountInfo
# 需要導入模塊: from DoctorSpring.models import User [as 別名]
# 或者: from DoctorSpring.models.User import update [as 別名]
def updateAcountInfo():
type=request.args.get('type')
if type:
type=string.atoi(type) #醫生:1 病人:2
else:
type=2
userId=None
if session.has_key('userId'):
userId=session['userId']
if userId is None:
return redirect(LOGIN_URL)
form=UserUpdateForm(request.form)
paraRs=form.validate()
if rs.SUCCESS.status==paraRs.status:
User.update(userId,form.name,form.account,form.mobile,form.address,form.email,form.identityCode,form.yibaoCard)
if type==1:
doctor=Doctor(userId)
doctor.identityPhone=form.identityPhone
hospitalId=Doctor.update(doctor)
if hospitalId:
hospital=Hospital(form.hospitalName)
hospital.id=hospitalId
Hospital.updateHospital(hospital)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例2: avatarfileUpload
# 需要導入模塊: from DoctorSpring.models import User [as 別名]
# 或者: from DoctorSpring.models.User import update [as 別名]
def avatarfileUpload():
userId=None
userId=request.form.get("userId")
if session.has_key('userId') and userId is None:
userId=session['userId']
if userId is None:
return redirect(LOGIN_URL)
userId = string.atoi(userId)
user=User.getById(userId,None)
if user is None:
return json.dumps(rs.ResultStatus(rs.FAILURE.status,"賬戶不存在"),ensure_ascii=False )
try:
if request.method == 'POST':
file_infos = []
files = request.files
for key, file in files.iteritems():
if file and isPicture(file.filename):
filename = file.filename
# file_url = oss_util.uploadFile(diagnoseId, filename)
from DoctorSpring.util.oss_util import uploadAvatarFromFileStorage
fileurl = uploadAvatarFromFileStorage(userId, filename, file,'',{})
if fileurl:
user.imagePath=fileurl
User.update(userId,imagePath=fileurl)
file_infos.append(dict(
name=filename,
url=fileurl))
return jsonify(files=file_infos)
else:
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
except Exception,e:
print e.message
return json.dumps(rs.FAILURE.__dict__,ensure_ascii=False)
示例3: resetPasswd
# 需要導入模塊: from DoctorSpring.models import User [as 別名]
# 或者: from DoctorSpring.models.User import update [as 別名]
def resetPasswd(mobileNumber):
userId=str(int(User.get_id_by_phone(mobileNumber)[0]))
form=UserResetPasswdForm(request.form)
result=form.validate()
if result.status==rs.SUCCESS.status:
user = User.getById(userId)
newHashPasswd=generate_password_hash(form.newPasswd)
User.update(userId,passwd=newHashPasswd)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
示例4: checkVerifyCode
# 需要導入模塊: from DoctorSpring.models import User [as 別名]
# 或者: from DoctorSpring.models.User import update [as 別名]
def checkVerifyCode():
code=request.form.get('verifyCode')
mobile=request.form.get('mobile')
verifyCode=session.get('verifyCode')
userId=session.get('userId')
if verifyCode is None:
result=rs.ResultStatus(rs.FAILURE.status,"請重新產生驗證碼")
return json.dumps(result.__dict__,ensure_ascii=False)
if code is None:
result=rs.ResultStatus(rs.FAILURE.status,"驗證碼不能為空,請輸入驗證碼")
return json.dumps(result.__dict__,ensure_ascii=False)
if code == verifyCode:
if mobile:
import re
#p = re.compile(r"((13|14|15|18)d{9}$)")
if len(mobile)==11:
user=User.update(userId,mobile=mobile,isBindPhone=constant.UserPhoneBind.Binded);
if user:
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"更新失敗")
return json.dumps(result.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"輸入的電話號碼格式有問題")
return json.dumps(result.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"請輸入電話號碼")
return json.dumps(result.__dict__,ensure_ascii=False)
else:
result=rs.ResultStatus(rs.FAILURE.status,"驗證碼錯誤,請重新輸入驗證碼")
return json.dumps(result.__dict__,ensure_ascii=False)
示例5: updateDoctorInfo
# 需要導入模塊: from DoctorSpring.models import User [as 別名]
# 或者: from DoctorSpring.models.User import update [as 別名]
def updateDoctorInfo():
form=DoctorUpdateForm(request.form)
doctor=Doctor(form.userId)
doctor.departmentId=form.department
doctor.hospitalId=form.hospital
doctor.status=form.status
doctor.title=form.title
Doctor.update(doctor)
doctor=Doctor.getByUserId(form.userId)
if doctor:
for skill in form.skills:
doctorsKill=Doctor2Skill(doctor.id,skill)
Doctor2Skill.save(doctorsKill)
User.update(form.userId,status=constant.ModelStatus.Normal)
result=rs.ResultStatus(rs.SUCCESS.status,rs.SUCCESS.msg,None)
return json.dumps(result.__dict__,ensure_ascii=False)
示例6: changePasswd
# 需要導入模塊: from DoctorSpring.models import User [as 別名]
# 或者: from DoctorSpring.models.User import update [as 別名]
def changePasswd():
userId=None
if session.has_key('userId'):
userId=session['userId']
if userId is None:
return redirect(LOGIN_URL)
form=UserChangePasswdForm(request.form)
result=form.validate()
if result.status==rs.SUCCESS.status:
user = User.getById(userId)
if user and user.check_password(form.oldPasswd):
newHashPasswd=generate_password_hash(form.newPasswd)
User.update(userId,passwd=newHashPasswd)
return json.dumps(rs.SUCCESS.__dict__,ensure_ascii=False)
else:
resultStatus=rs.ResultStatus(rs.FAILURE.status,"未登錄或者密碼錯誤")
return json.dumps(resultStatus.__dict__,ensure_ascii=False)
return json.dumps(result.__dict__,ensure_ascii=False)