本文整理汇总了Python中main.PageData.profileuser方法的典型用法代码示例。如果您正苦于以下问题:Python PageData.profileuser方法的具体用法?Python PageData.profileuser怎么用?Python PageData.profileuser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main.PageData
的用法示例。
在下文中一共展示了PageData.profileuser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_user_profile
# 需要导入模块: from main import PageData [as 别名]
# 或者: from main.PageData import profileuser [as 别名]
def show_user_profile(username):
pd = PageData()
pd.title = "Profile for " + username
try:
pd.profileuser = SiteUser.create(username)
except NoUser:
return page_not_found()
return render_template('profile/main.html', pd=pd)
示例2: show_user_profile
# 需要导入模块: from main import PageData [as 别名]
# 或者: from main.PageData import profileuser [as 别名]
def show_user_profile(username):
pd = PageData()
pd.title = "Profile for " + username
pd.timezones = get_timezones()
try:
pd.profileuser = SiteUser.create(username)
except NoUser:
return page_not_found(404)
return render_template('profile.html', pd=pd)
示例3: show_user_profile_collections
# 需要导入模块: from main import PageData [as 别名]
# 或者: from main.PageData import profileuser [as 别名]
def show_user_profile_collections(username):
pd = PageData()
pd.title = "Collections for " + username
pd.timezones = get_timezones()
try:
pd.profileuser = SiteUser.create(username)
except NoUser:
return page_not_found()
return render_template('profile/collections.html', pd=pd)
示例4: show_user_profile_prefs
# 需要导入模块: from main import PageData [as 别名]
# 或者: from main.PageData import profileuser [as 别名]
def show_user_profile_prefs(username):
pd = PageData()
pd.title = "Preferences for " + username
pd.timezones = get_timezones()
if not hasattr(pd, 'authuser') or pd.authuser.username != username:
return page_not_found()
try:
pd.profileuser = SiteUser.create(username)
except NoUser:
return page_not_found()
return render_template('profile/preferences.html', pd=pd)
示例5: pm
# 需要导入模块: from main import PageData [as 别名]
# 或者: from main.PageData import profileuser [as 别名]
def pm(username):
pd = PageData()
try:
pmuser = SiteUser.create(username)
except (NoItem, NoUser):
return page_not_found()
if 'username' in session:
if session['username'] == username:
pd.profileuser = pmuser
return render_template('profile/messages.html', pd=pd)
else:
pd.recipient = pmuser
if request.method == 'POST':
message = request.form['body']
subject = request.form['subject']
if 'parent' in request.form:
parent = deobfuscate(request.form['parent'])
else:
parent = None
if message and subject:
messageid = send_pm(pd.authuser.uid, pd.recipient.uid, subject, message, None, parent)
if messageid:
flash('Message sent!')
if parent:
return redirect_back('/user/' + username + '/pm')
else:
return redirect('/user/' + pd.authuser.username + '/pm/' + obfuscate((messageid)))
else:
# TODO re-fill form
flash('No message or subject')
return redirect_back('/user/' + username + '/pm')
return render_template('sendpm.html', pd=pd)