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


Python User.set_password方法代码示例

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


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

示例1: main

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set_password [as 别名]
def main():
	connection_string = "mongodb://localhost"
	connection = pymongo.MongoClient(connection_string)
	database = connection.starleague

	# print "got connection"
	subject_dao = subjectDAO.SubjectDAO(database)
	
	try:
		
		# subjects = subject_dao.get_all_subjects()
		# subjects = subject_dao.get_subjects_by_batch("2011-2013")
		# for subject in subjects:
		# 	print subject
		# 	print json.dumps(subject.__dict__)
		
		user = User()
		user.set_name("jake")
		user.set_batch("2010-2014")
		user.set_password("harper")



		# result = subject_dao.insert_subject(subject)
		# print result

	except Exception, e:
		print e
开发者ID:raghothams,项目名称:starleague,代码行数:30,代码来源:db.py

示例2: seed_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set_password [as 别名]
def seed_users():
    """Seed users with test users."""

    emilypass = os.environ.get("EMILYPASS")
    emily = User(username='emily')
    emily.set_password(emilypass)

    nickpass = os.environ.get("NICKPASS")
    nick = User(username="nick")
    nick.set_password(nickpass)

    db_session.add(emily)
    db_session.add(nick)
    db_session.commit()
开发者ID:chagge,项目名称:menureader,代码行数:16,代码来源:seed.py

示例3: user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import set_password [as 别名]
def user():
    if request.method == 'POST':
        setting = request.form.get('setting')
        user_id = request.form.get('value_0')
        value   = request.form.get('value_1')

        if not setting or not user_id:
            abort(400)
        try:
            user_id = int(user_id)
        except:
            abort(400)

        user = User(id=user_id)
        if not user.id:
            flash(messages.user_not_found)
            return render_template('admin/user.html',
                                   user_list=get_user_list())

        if setting == 'password':
            if not value:
                abort(400)

            user.set_password(value)
            flash(messages.user_set_password)

        elif setting == 'delete':
            user.delete()
            flash(messages.user_deleted)
            return redirect(url_for('admin_user'))

        elif setting == 'activate':
            if not value:
                abort(400)
            if value == 'True':
                user.update_setting('active', True)
                flash(messages.user_activated)
            else:
                user.update_setting('active', False)
                flash(messages.user_deactivated)

            return redirect(url_for('admin_user_details', id=user.id))

        else:
            abort(400)

    users = get_user_list()
    return render_template('admin/user.html', user_list=users)
开发者ID:davidnieder,项目名称:blackboard,代码行数:50,代码来源:admin.py


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