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


Python User.id方法代码示例

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


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

示例1: user_loader

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def user_loader(email):
	"""The user loader implemented by Flask-Login loads a user via email."""
	if not backend.emailAlreadyInUse(email):
		return
	else:
		user = User().loadUser(email)
		user.id = email
		return user
开发者ID:ResidentMario,项目名称:cultural-insight,代码行数:10,代码来源:app.py

示例2: request_loader

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def request_loader(request):
	username = request.form.get('username', None)
	password = request.form.get('password', None)
	if not mongo_handler_organizations.is_valid_organization(username):
		return
	user = User()
	user.id = username
	user.is_authenticated = mongo_handler_organizations.is_authorized(username, password)
	return user
开发者ID:c4fcm,项目名称:NewsPix,代码行数:11,代码来源:server.py

示例3: _parseUser

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
    def _parseUser(self, data):
        user = User()
        user.id = data[0]
        user.name = data[1]
        user.country = data[2]
        user.solved = data[3]
        user.submitted = data[4]
        user.ratio = data[5]

        return user
开发者ID:wkoder,项目名称:tojxt,代码行数:12,代码来源:persistence.py

示例4: initiate_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
 def initiate_users(self, members):
     self.brain['users'] = self.load_config('users')
     for member in members:
         if member.id in self.brain['users'].keys():
             continue
         user = User()
         user.name = member.name
         user.id = member.id
         self.brain['users'][member.id] = user
     self.save_config('users', self.brain['users'])
开发者ID:tuckismad,项目名称:discordbot,代码行数:12,代码来源:bot.py

示例5: request_loader

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def request_loader(request):
	"""The user loader implemented by Flask-Login loads a user via request form."""
	email = request.form.get('email')
	password = request.form.get('password')
	if not backend.authenticateUser(email, password):
		return
	else:
		user = User()
		user.id = email
		return user
开发者ID:ResidentMario,项目名称:cultural-insight,代码行数:12,代码来源:app.py

示例6: load_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def load_user(username):
    '''
    Loads user from the currently authenticated AD user
    '''
    try:
        if username in all_users.keys():
            user = User(username)
            user.id = username
            return user
    except:
        return None
开发者ID:JaySpell,项目名称:isilontools,代码行数:13,代码来源:views.py

示例7: parseUsers

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def parseUsers(fromRank):
    fromRank -= 1
    url = "http://acm.tju.edu.cn/toj/ranklist.php?start=%d" % fromRank
    html = _readURL(url)
    lines = html.split('\n')
    
    users = list()
    linePos = 29
    while linePos < len(lines):
        token = lines[linePos]
        if token.find("</table>") == 0:
            break
        
        user = User()
        user.name = _getContent(token, len(token)-10, 0)
        user.rank = (linePos - 29) / 3 + fromRank + 1
        end = len(token) - 17 - len(user.name)
        user.id = _getContent(token, end, 0, "\"")
        user.id = user.id[5 : ]
        user.country = _getContent(token, end - len(user.id) - 25, 0, "\"").title()
        
        token = lines[linePos+1]
        while lines[linePos+2].find("<td>") != 0:
            token += lines[linePos+2]
            linePos += 1
        user.solved = int(_getContent(token, len(token)-17, 0))
        
        token = lines[linePos+2]
        end = len(token) - 11
        ratio = _getContent(token, end, 0)
        if ratio != "??":
            user.ratio = float(ratio)
        end -= len(ratio) + 9
        perc = _getContent(token, end, 0)
        end -= 13 + len(perc)
        user.submitted = int(_getContent(token, end, 0))
        
        users.append(user)
        linePos += 3
        
    return users
开发者ID:wkoder,项目名称:algorithms,代码行数:43,代码来源:parsers.py

示例8: manage_users_edit

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def manage_users_edit(name=None):
    if request.method == 'GET':
        error = None
        u = User()
        u.name = name
        u = get_user(u)

        if u is None:
            error = "User existiert nicht"

        return render_template('manage_users_edit.html', user_to_edit=u, error=error, user=get_user_by_name(session.get('name')))

    if request.method == 'POST':
        u = User()
        #print request.form
        u.id = request.form['id']
        u.name = request.form['username'].lower()
        u.longname=request.form['longname']
        u.email = request.form['email']
        u.rfid_id = request.form['rfid_id']

        if 'isblack' in request.form:
            u.isblack = True
        else:
            u.isblack = False

        if 'isbaron' in request.form:
            u.isbaron = True
        else:
            u.isbaron = False

        if 'isshown' in request.form:
            u.isshown = True
        else:
            u.isshown = False

        if 'autoblack' in request.form:
            u.autoblack = True
        else:
            u.autoblack = False

        if 'onlyrfid' in request.form:
            u.onlyrfid = True
        else:
            u.onlyrfid = False

        u2 = get_user_by_id(u.id)
        u.password = u2.password

        update_user(u)

        return redirect('/manage_users')
开发者ID:ulrichknecht,项目名称:baroness,代码行数:54,代码来源:views.py

示例9: login

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def login():
	if request.method == 'POST':
		username = request.form.get('username', None)
		password = request.form.get('password', None)
		if mongo_handler_organizations.is_authorized(username, password):
			user = User()
			user.id = username
			flask_login.login_user(user)
			return redirect('/admin')
		else:
			flash("Login failed!")

	return app.send_static_file('login.html')
开发者ID:c4fcm,项目名称:NewsPix,代码行数:15,代码来源:server.py

示例10: get_user_by_id

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def get_user_by_id(id):
    row = query_db("SELECT * FROM USERS WHERE ID = ?", [id], one=True)
    u = User()
    if row is None:
        return None
    u.id=row[0]
    u.name=row[1]
    u.password=row[2]
    u.longname=row[3]
    u.email=row[4]
    u.isblack=row[5]
    u.isbaron=row[6]
    u.isshown=row[7]
    u.autoblack=row[8]
    u.onlyrfid=row[9]
    u.rfid_id = get_rfid_ids_by_userid(u.id)
    logging.debug(u)
    return u
开发者ID:ulrichknecht,项目名称:baroness,代码行数:20,代码来源:database.py

示例11: get_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def get_users():
    rows = query_db("SELECT * FROM USERS")
    users = []
    for row in rows:
        u = User()
        u.id=row[0]
        u.name=row[1]
        u.password=row[2]
        u.longname=row[3]
        u.email=row[4]
        u.isblack=row[5]
        u.isbaron=row[6]
        u.isshown=row[7]
        u.autoblack=row[8]
        u.onlyrfid=row[9]
        u.rfid_id = get_rfid_ids_by_userid(u.id)
        users.append(u)
    return users
开发者ID:ulrichknecht,项目名称:baroness,代码行数:20,代码来源:database.py

示例12: list_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
    def list_users(self):

        response = self._server._api_request(
            "GET",
            "/groups/%d/users" % (self.id),
            ""
        )
        if response is not None:
            self._users = []
            if "users" in response and response["users"] is not None:
                for u in response["users"]:
                    user = User(self._server)
                    user.id = u["id"]
                    user.username = u["username"]
                    user.name = u["name"]
                    user.email = u["email"]
                    user.permissions = u["permissions"]
                    user.lastlogin = u["lastlogin"]
                    user.type = u["type"]
                    self._users.append(user)
            return True
        else:
            return False
开发者ID:QKaiser,项目名称:pynessus,代码行数:25,代码来源:group.py

示例13: user_loader

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import id [as 别名]
def user_loader(username):
	if not mongo_handler_organizations.is_valid_organization(username):
		return
	user = User()
	user.id = username
	return user
开发者ID:c4fcm,项目名称:NewsPix,代码行数:8,代码来源:server.py


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