本文整理汇总了Python中model.user.User.full_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.full_name方法的具体用法?Python User.full_name怎么用?Python User.full_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.full_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_account
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import full_name [as 别名]
def post_account():
# Flask apparently throws 400 errors if POST form data isn't present.
# Full name
user_id = session['user_id']
location = settings.get_user(user_id)['feed_location']
user = User(local_url=location)
if request.form.get('full_name_changed') == 'true':
user.full_name = request.form['full_name']
# Username
if request.form.get('username_changed') == 'true':
username= request.form['username']
if len(username) > 0:
user.username = username
# Bio
if request.form.get('bio_changed') == 'true':
user.description = request.form['bio']
# Email
if request.form.get('email_changed') == 'true':
email = request.form['email']
user_dict = settings.get_user(user_id)
user_dict['email'] = email
settings.add_user(user_dict)
# Password
if request.form.get('password_changed') == 'true':
password = request.form['password']
password_confirm = request.form['password_confirm']
if password == password_confirm:
user_dict = settings.get_user(user_id)
user_dict['pwd_hash'] = generate_password_hash(password)
settings.add_user(user_dict)
# Language
if request.form.get('language_changed') == 'true':
user.language = request.form['language']
return render_template('account.html', user=user, error='Your settings have been saved.')
示例2: test_remote_full_name
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import full_name [as 别名]
def test_remote_full_name(self):
full_name = 'dummy'
user = User(remote_url='http://microblog.brianschrader.com/feed')
try:
# should fail.
user.full_name = full_name
self.fail('setting a remote user should be forbidden.')
except:
pass
示例3: test_local_full_name
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import full_name [as 别名]
def test_local_full_name(self):
full_name = 'John Jacob Jinglehiemer-Schmidt'
user = User(local_url='user/feed.xml')
try:
user.full_name = full_name
except Exception as e:
print e
self.fail('Setting locl user full_name failed.')
self.assertEqual(user.full_name, full_name)
示例4: test_cached_full_name
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import full_name [as 别名]
def test_cached_full_name(self):
full_name = 'Joe Blow'
user = User(entries={'full_name': full_name})
full_name = 'Joseph Blow'
try:
user.full_name = full_name
except Exception as e:
print e
self.fail('Setting cached full_name failed.')
self.assertEqual(user.full_name, full_name)