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


Python User.name方法代码示例

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


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

示例1: manage_users_edit

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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

示例2: login

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
def login():
    error = None

    if 'name' in session: #check if usr is already logged in
        return redirect('/')

    if request.method == 'POST':
        u = User()
        u.name = request.form['username'].lower()

        u = get_user(u)

        if u is None:
            error = 'User does not exist!'
            return render_template('login.html', error=error, user=get_user_by_name(session.get('name')))
        #if u.password != request.form['password']:
        # bcrypt.checkpy(plaintxt, hash)
        if not bcrypt.checkpw(request.form['password'], u.password):
            error = 'Wrong password!'
            return render_template('login.html', error=error, user=get_user_by_name(session.get('name')))

        session['name'] = u.name
        return redirect('/')

    return render_template('login.html', error=error, user=get_user_by_name(session.get('name')))
开发者ID:ulrichknecht,项目名称:baroness,代码行数:27,代码来源:views.py

示例3: decorated_function

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
 def decorated_function(*a,**kw):
     u = User()
     u.name = session.get('name', None)
     u = get_user(u)
     if not u or not u.isbaron:
         return render_template("not_baron.html", user=get_user_by_name(session.get('name'))), 401
     return fn(*a, **kw)
开发者ID:ulrichknecht,项目名称:baroness,代码行数:9,代码来源:check_rights.py

示例4: addUsers

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
 def addUsers(self, name):
     """Get followers of a certain user and add it to the corpus.users array"""
     try:
         followers = self.corpus.getUserFollowers(self.twitter, name)
     except urllib.request.HTTPError:
         print('An Error Occured, please restart the application.')
     for tUser in followers['users']:
         user = User()
         iid = tUser['id']
         if (iid in self.corpus.ids):
             #print('ding')
             continue
         else:
             user.uid = iid
             self.corpus.ids.append(iid)
             user.screen_name = tUser['screen_name']
             user.name = tUser['name']
             user.description = tUser['description']
             user.createdAt = tUser['created_at']
             user.nrFriends = tUser['friends_count']
             user.nrFollowers = tUser['followers_count']
             user.protected = tUser['protected']
             user.deltaTime = 0
             #Delta Time could need workaround
             self.corpus.users.append(user)
开发者ID:DSSN-Practical,项目名称:DSSNTweetCorpus,代码行数:27,代码来源:handler.py

示例5: __init__

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
	def __init__(self, content="", *params):
		Response.__init__(self, command.LIST, content, *params)
		self.users = []
		for entry in content.splitlines():
			parts = re.split(r'\s+',entry.strip(),1)
			u = User(parts[0])
			if len(parts) > 1:
				u.name = parts[1]
			self.users.append(u)
开发者ID:habbes,项目名称:room13-prototype,代码行数:11,代码来源:response.py

示例6: _parseUser

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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

示例7: initiate_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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

示例8: read_last_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
def read_last_user():
    if (not os.path.exists('mm.conf')):
        return None
    config = ConfigParser.RawConfigParser()
    config.read('mm.conf')
    u = User("Default")
    u.name = config.get('LastUser', 'name')
    y = int(config.get('LastUser', 'year'))
    m = int(config.get('LastUser', 'month'))
    d = int(config.get('LastUser', 'day'))
    u.longevity = float(config.get('LastUser', 'longevity'))
    # TODO handle times here (times are allowed in User)
    u.birthday = datetime(y,m,d,0,0,0)
    if u.name != 'default':
        return None
    else:
        return u
开发者ID:mannd,项目名称:morbidmeter,代码行数:19,代码来源:mm.py

示例9: before_loop

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
def before_loop(username):
    """Setting up for main loop"""
    from temp_aber import maxu
    
    import gamesys
    import gamebuffer
    import signals
    import world
    import user
    import key

    global guser

    signals.init()
    guser = User(username)
    print("Entering Game ...")
    #~ WTF?
    tty=0;
    #~ if tty=4: initbbc(): initscr(): topscr()
    #~ WTF?
    guser.greeting()

    #~ Setting up game system
    key.setup()
    gamebuffer.makebfr()
    guser.msgId = -1

    guser.puton()

    #~ Some checks
    if not world.openw():
        raise Exception("Sorry AberMUD is currently unavailable")
        #~ Crapup
    if guser.userId >= maxu:
        raise Exception("Sorry AberMUD is full at the moment")
        #~ Crapup

    guser.name = username
    guser.chkMsg()
    
    world.closew()
    
    guser.msgId = -1
    guser.special(".g")
    #~ WTF?
    i_setup = 1
开发者ID:d2emon,项目名称:abermud,代码行数:48,代码来源:main.py

示例10: get_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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

示例11: get_user_by_id

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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

示例12: getUsers

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
    def getUsers(self):
        search = self.twython.search(q=self.hashtag)

        tweets = search['statuses']
        users_dictionary = {}
        users_list = []

        for tweet in tweets:
            u = User()

            if not users_dictionary.has_key(tweet['user']['id']):
                u.name = tweet["user"]["name"].encode("utf-8")

                comment = self.getSentiment(tweet['text'].encode('utf-8'))
                u.comments.append(comment)

                users_dictionary[tweet['user']['id']] = u
                users_list.append(u.getFormatedName())
            else:
                u = users_dictionary[tweet['user']['id']]

                comment = self.getSentiment(tweet['text'].encode('utf-8'))
                u.comments.append(comment)

                users_dictionary[tweet['user']['id']] = u

        #Asignacion de genero
        payload = {'name[]': users_list}
        response = requests.get('https://api.genderize.io', params=payload)
        genders_dictionary = response.json()
        
        for user in users_dictionary:
            for gender in genders_dictionary:
                if users_dictionary[user].formated_name == gender["name"].encode('utf-8'):
                    if not gender["gender"]:
                        users_dictionary[user].gender = 'undefined'
                    else:
                        users_dictionary[user].gender = gender["gender"].encode('utf-8')

                    genders_dictionary.remove(gender)
                    break
      
        return users_dictionary
开发者ID:AngelGus79,项目名称:MIS,代码行数:45,代码来源:tweetNavigator.py

示例13: register_user

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [as 别名]
 def register_user(self, name, last_name, city, age, email, login, password, secret_word):
     # if email in self.emails:
     #     print('This email is already used')
     #     return
     if login in self.users:
         print('This login is already taken')
         return
     # self.emails.add(email)
     new_user = User()
     new_user.name = name
     new_user.last_name = last_name
     new_user.city = city
     new_user.age = age
     new_user.email = email
     new_user.login = login
     new_user.password = password
     new_user.secret_word = secret_word
     self.users[login] = new_user
     print('registration successful')
开发者ID:cl0ne,项目名称:kpi-educational-tasks,代码行数:21,代码来源:registration_old.py

示例14: parseUsers

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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

示例15: list_users

# 需要导入模块: from user import User [as 别名]
# 或者: from user.User import name [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


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