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


Python User.get_by_name方法代码示例

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


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

示例1: validate

# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import get_by_name [as 别名]
 def validate(self):
     try:
         if self.email is None or "@" not in self.email:
             failure = ResultStatus(FAILURE.status, "邮箱地址格式不正确")
             return failure
         else:
             user = User.get_by_name(self.email)
             if user is not None:
                 failure = ResultStatus(FAILURE.status, "邮箱地址已注册")
                 return failure
         if self.username is None:
             failure = ResultStatus(FAILURE.status, "用户名为空")
             return failure
         if self.password is None:
             failure = ResultStatus(FAILURE.status, "密码为空")
             return failure
         if self.real_name is None:
             failure = ResultStatus(FAILURE.status, "真实姓名为空")
             return failure
         if self.identity_phone is None:
             failure = ResultStatus(FAILURE.status, "注册号码为空")
             return failure
         if self.cellphone is None:
             failure = ResultStatus(FAILURE.status, "手机号码格式不对")
             return failure
         else:
             user = User.get_by_name(self.cellphone)
             if user is not None:
                 failure = ResultStatus(FAILURE.status, "手机号码已注册")
                 return failure
     except Exception, e:
         return FAILURE
开发者ID:LichuanLu,项目名称:redberry,代码行数:34,代码来源:forms.py

示例2: login

# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import get_by_name [as 别名]
def login():
    form = LoginForm(request.form)
    formResult = form.validate()
    if formResult.status == rs.SUCCESS.status:
        # session['remember_me'] = form.remember_me.data
        # login and validate the user...
        user = User.get_by_name(form.username)
        if user is not None and user.check_password(form.password):
            login_session(user)
            formResult.msg = request.host_url + "homepage"
        else:
            formResult = rs.LOGIN_CHECK_FARLURE

    return jsonify(formResult.__dict__)
开发者ID:LichuanLu,项目名称:redberry,代码行数:16,代码来源:user_view.py

示例3: validate

# 需要导入模块: from DoctorSpring.models import User [as 别名]
# 或者: from DoctorSpring.models.User import get_by_name [as 别名]
    def validate(self):
        try:

            if self.nickname is None:
                failure = ResultStatus(FAILURE.status, "昵称为空")
                return failure
            if self.password is None:
                failure = ResultStatus(FAILURE.status, "密码为空")
                return failure
            if self.name is None:
                failure = ResultStatus(FAILURE.status, "用户名为空")
                return failure
            else:
                user = User.get_by_name(self.name)
                if user is not None:
                    failure = ResultStatus(FAILURE.status, "该用户已存在")
                    return failure
        except Exception, e:
            return FAILURE
开发者ID:LichuanLu,项目名称:blueberry,代码行数:21,代码来源:forms.py


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