当前位置: 首页>>代码示例>>Python>>正文


Python UserInfo.email方法代码示例

本文整理汇总了Python中models.UserInfo.email方法的典型用法代码示例。如果您正苦于以下问题:Python UserInfo.email方法的具体用法?Python UserInfo.email怎么用?Python UserInfo.email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.UserInfo的用法示例。


在下文中一共展示了UserInfo.email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import email [as 别名]
	def post(self):
		userinfo = self.currentuser
		if userinfo == None:
			userinfo = UserInfo()
		
		userinfo.nickname = cgi.escape(self.request.get('nickname'))
		if is_empty(userinfo.nickname):
			self.render_edit("nickname can't be empty")
			return
		
		email = cgi.escape(self.request.get('email'))
		avatar = self.request.get('avatar')
		first_login = self.request.get('first_login')
		
		if avatar != '':
			avatar = images.resize(avatar, 128)
			userinfo.avatar = db.Blob(avatar)
			
		if email == '':
			email = 'none'
		userinfo.email = email

		if first_login != '':
			userinfo.lastposted = date.today()
			userinfo.lastvoted = userinfo.lastposted
			
		userinfo.put()
		self.redirect('/')
开发者ID:paulsc,项目名称:lunchdiscussion,代码行数:30,代码来源:views.py

示例2: regUser

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import email [as 别名]
def regUser(request):
  reponse = dict()
  reponse.update(status = 0, msg = '录入信息错误,请重新录入!')
  msg = ''
  if request.method == 'POST':
    form = UserInfoForm(request.POST)
    if form.is_valid():
      if checkUserId(form.cleaned_data['userId']):
        msg = '用户名已存在!'
      elif checkEmail(form.cleaned_data['email']):
        msg = '邮箱已存在!'
      else:
        userInfo = UserInfo()
        userInfo.userId = form.cleaned_data['userId']
        userInfo.email = form.cleaned_data['email']
        userInfo.passwd = form.cleaned_data['passwd']
        userInfo.create();
        msg = '注册成功!'
        reponse.update(status = 1)
  if msg != '':
    reponse.update(msg = msg)
  return HttpResponse(json.dumps(reponse),mimetype='application/json')
开发者ID:proming,项目名称:gaemarks,代码行数:24,代码来源:userApi.py

示例3: post

# 需要导入模块: from models import UserInfo [as 别名]
# 或者: from models.UserInfo import email [as 别名]
    def post():
        parser = reqparse.RequestParser()
        parser.add_argument('login_type', type=int, required=True, help=u'缺少参数 login_type必须为 0(注册用户),1(微博用户),2(QQ用户)')
        parser.add_argument('nick_name', type=str, required=True, help=u'缺少参数 nick_name必须唯一')
        parser.add_argument('password', type=str, required=False)
        parser.add_argument('login_name', type=str, required=False)
        parser.add_argument('open_id', type=str, required=False)
        args = parser.parse_args()

        login_type = args.get('login_type')
        nick_name = args.get('nick_name')
        password = args.get('password', None)
        login_name = args.get('login_name', None)
        open_id = args.get('open_id', None)

        err = {'status': 1}

        if login_type == 0:  # 注意纯数字的昵称和手机号的冲突,以后不同用户的昵称和不能用户登录名不能相同,同一个用户可以
            if not password:
                err['message'] = '注册用户必须要有密码'
                return err
            if not login_name:
                err['message'] = '注册用户必须有登陆名'
                return err
            if nick_name.count('@'):
                err['message'] = 'nick_name不能包含@符号'
                return err

            if User.query.filter(User.login_name == login_name).count():
                err['message'] = 'login_name已重复'
                return err
            if User.query.filter(User.nick_name == login_name).count():
                err['message'] = 'login_name已重复'
                return err
            if User.query.filter(User.nick_name == nick_name).count():
                err['message'] = 'nick_name已重复'
                return err
            if User.query.filter(User.login_name == nick_name).count():
                err['message'] = 'nick_name已重复'
                return err

            user = User(login_type=login_type, nick_name=nick_name, password=password, login_name=login_name)
            db.add(user)
            db.commit()
            user = User.query.filter(User.login_name == login_name).first()
            user_info = UserInfoDb(user_id=user.id)
            if login_name.count('@'):
                user_info.email = login_name
            db.add(user_info)
            db.commit()

        if login_type == 1 or login_type == 2:
            if not open_id:
                err['message'] = '第三方登陆用户必须有open_id'
                return err
            if nick_name.count('@'):
                err['message'] = 'nick_name不能包含@符号'
                return err

            if User.query.filter(User.open_id == open_id).count():
                err['message'] = 'open_id已重复'
                return err
            if User.query.filter(User.nick_name == nick_name).count():
                err['message'] = 'nick_name已重复'
                return err

            user = User(login_type=login_type, nick_name=nick_name, open_id=open_id)
            db.add(user)
            db.commit()
            user = User.query.filter(User.login_name == login_name).first()
            user_info = UserInfoDb(user_id=user.id)
            db.add(user_info)
            db.commit()

        return {'user': pickler.flatten(User.query.filter(User.nick_name == nick_name).first()), 'status': 0}
开发者ID:pesome,项目名称:pub_py,代码行数:77,代码来源:user.py


注:本文中的models.UserInfo.email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。