當前位置: 首頁>>代碼示例>>Python>>正文


Python PageData.profileuser方法代碼示例

本文整理匯總了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)
開發者ID:subiki,項目名稱:scarfage,代碼行數:12,代碼來源:profile.py

示例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)
開發者ID:oamike,項目名稱:scarfage,代碼行數:13,代碼來源:profile.py

示例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)
開發者ID:subiki,項目名稱:scarfage,代碼行數:13,代碼來源:profile.py

示例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)
開發者ID:subiki,項目名稱:scarfage,代碼行數:16,代碼來源:profile.py

示例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)
開發者ID:subiki,項目名稱:scarfage,代碼行數:42,代碼來源:pm.py


注:本文中的main.PageData.profileuser方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。