本文整理汇总了Python中weasyl.profile.select_userinfo函数的典型用法代码示例。如果您正苦于以下问题:Python select_userinfo函数的具体用法?Python select_userinfo怎么用?Python select_userinfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了select_userinfo函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: followed_
def followed_(request):
cachename = "user/followed.html"
form = request.web_input(userid="", name="", backid=None, nextid=None)
form.name = request.matchdict.get('name', form.name)
form.userid = define.get_int(form.userid)
otherid = profile.resolve(request.userid, form.userid, form.name)
if not otherid:
raise WeasylError("userRecordMissing")
elif not request.userid and "h" in define.get_config(otherid):
return Response(define.errorpage(request.userid, errorcode.no_guest_access))
userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)
return Response(define.webpage(request.userid, cachename, [
# Profile information
userprofile,
# User information
profile.select_userinfo(otherid, config=userprofile['config']),
# Relationship
profile.select_relation(request.userid, otherid),
# Followed
followuser.select_followed(request.userid, otherid, limit=44,
backid=define.get_int(form.backid), nextid=define.get_int(form.nextid)),
]))
开发者ID:Syfaro,项目名称:weasyl,代码行数:27,代码来源:profile.py
示例2: staffnotes_
def staffnotes_(request):
form = request.web_input(userid="")
otherid = profile.resolve(request.userid, define.get_int(form.userid), request.matchdict.get('name', None))
if not otherid:
raise WeasylError("userRecordMissing")
userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)
has_fullname = userprofile['full_name'] is not None and userprofile['full_name'].strip() != ''
page_title = u"%s's staff notes" % (userprofile['full_name'] if has_fullname else userprofile['username'],)
page = define.common_page_start(request.userid, title=page_title)
userinfo = profile.select_userinfo(otherid, config=userprofile['config'])
reportstats = profile.select_report_stats(otherid)
userinfo['reportstats'] = reportstats
userinfo['reporttotal'] = sum(reportstats.values())
page.append(define.render('user/shouts.html', [
# Profile information
userprofile,
# User information
userinfo,
# Relationship
profile.select_relation(request.userid, otherid),
# Myself
profile.select_myself(request.userid),
# Comments
shout.select(request.userid, ownerid=otherid, staffnotes=True),
# Feature
"staffnotes",
]))
return Response(define.common_page_end(request.userid, page))
开发者ID:Syfaro,项目名称:weasyl,代码行数:32,代码来源:profile.py
示例3: GET
def GET(self, name=""):
now = time.time()
form = web.input(userid="", name="", backid=None, nextid=None)
form.name = name if name else form.name
form.userid = define.get_int(form.userid)
otherid = profile.resolve(self.user_id, form.userid, form.name)
if not otherid:
raise WeasylError("userRecordMissing")
elif not self.user_id and "h" in define.get_config(otherid):
return define.errorpage(self.user_id, errorcode.no_guest_access)
userprofile = profile.select_profile(otherid, images=True, viewer=self.user_id)
has_fullname = userprofile['full_name'] is not None and userprofile['full_name'].strip() != ''
page_title = u"%s's shouts" % (userprofile['full_name'] if has_fullname else userprofile['username'],)
page = define.common_page_start(self.user_id, title=page_title)
page.append(define.render(template.user_shouts, [
# Profile information
userprofile,
# User information
profile.select_userinfo(otherid, config=userprofile['config']),
# Relationship
profile.select_relation(self.user_id, otherid),
# Myself
profile.select_myself(self.user_id),
# Comments
shout.select(self.user_id, ownerid=otherid),
# Feature
"shouts",
]))
return define.common_page_end(self.user_id, page, now=now)
开发者ID:0x15,项目名称:weasyl,代码行数:35,代码来源:profile.py
示例4: shouts_
def shouts_(request):
form = request.web_input(userid="", name="", backid=None, nextid=None)
form.name = request.matchdict.get('name', form.name)
form.userid = define.get_int(form.userid)
otherid = profile.resolve(request.userid, form.userid, form.name)
if not otherid:
raise WeasylError("userRecordMissing")
elif not request.userid and "h" in define.get_config(otherid):
return Response(define.errorpage(request.userid, errorcode.no_guest_access))
userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)
has_fullname = userprofile['full_name'] is not None and userprofile['full_name'].strip() != ''
page_title = u"%s's shouts" % (userprofile['full_name'] if has_fullname else userprofile['username'],)
page = define.common_page_start(request.userid, title=page_title)
page.append(define.render('user/shouts.html', [
# Profile information
userprofile,
# User information
profile.select_userinfo(otherid, config=userprofile['config']),
# Relationship
profile.select_relation(request.userid, otherid),
# Myself
profile.select_myself(request.userid),
# Comments
shout.select(request.userid, ownerid=otherid),
# Feature
"shouts",
]))
return Response(define.common_page_end(request.userid, page))
开发者ID:Syfaro,项目名称:weasyl,代码行数:33,代码来源:profile.py
示例5: control_editprofile_get_
def control_editprofile_get_(request):
userinfo = profile.select_userinfo(request.userid)
return Response(define.webpage(request.userid, "control/edit_profile.html", [
# Profile
profile.select_profile(request.userid, commish=False),
# User information
userinfo,
]))
开发者ID:charmander,项目名称:weasyl,代码行数:8,代码来源:settings.py
示例6: GET
def GET(self):
userinfo = profile.select_userinfo(self.user_id)
userinfo['sorted_user_links'] = sorted(userinfo['user_links'].items(), key=lambda kv: kv[0].lower())
return define.webpage(self.user_id, "control/edit_profile.html", [
# Profile
profile.select_profile(self.user_id, commish=False),
# User information
userinfo,
])
开发者ID:0x15,项目名称:weasyl,代码行数:9,代码来源:settings.py
示例7: collections_
def collections_(request):
form = request.web_input(userid="", name="", backid=None, nextid=None,
folderid=None)
form.name = request.matchdict.get('name', form.name)
form.userid = define.get_int(form.userid)
config = define.get_config(request.userid)
rating = define.get_rating(request.userid)
otherid = profile.resolve(request.userid, form.userid, form.name)
if not otherid:
raise WeasylError("userRecordMissing")
elif not request.userid and "h" in define.get_config(otherid):
return Response(define.errorpage(request.userid, errorcode.no_guest_access))
userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)
has_fullname = userprofile['full_name'] is not None and userprofile['full_name'].strip() != ''
page_title = u"%s's collections" % (userprofile['full_name'] if has_fullname else userprofile['username'],)
page = define.common_page_start(request.userid, title=page_title)
url_format = "/collections?userid={userid}&%s".format(userid=userprofile['userid'])
result = pagination.PaginatedResult(
collection.select_list, collection.select_count, 'submitid', url_format, request.userid, rating, 66,
otherid=otherid, backid=define.get_int(form.backid), nextid=define.get_int(form.nextid), config=config)
page.append(define.render('user/collections.html', [
# Profile information
userprofile,
# User information
profile.select_userinfo(otherid, config=userprofile['config']),
# Relationship
profile.select_relation(request.userid, otherid),
# Collections
result,
]))
return Response(define.common_page_end(request.userid, page))
开发者ID:Syfaro,项目名称:weasyl,代码行数:37,代码来源:profile.py
示例8: GET
#.........这里部分代码省略.........
subfolders = list()
for sub in (i for i in old_folders if 'parentid' in i and i['parentid'] == fldr['folderid']):
subfolders.append({
"folder_id": sub['folderid'],
"title": sub['title']
})
newfolder['subfolders'] = subfolders
folders.append(newfolder)
user['folders'] = folders
commissions = {
"details": None,
"price_classes": None,
"commissions": self.convert_commission_setting(o_settings[0]),
"trades": self.convert_commission_setting(o_settings[1]),
"requests": self.convert_commission_setting(o_settings[2])
}
commission_list = commishinfo.select_list(otherid)
if commission_list:
commissions['details'] = commission_list['content']
if len(commission_list['class']) > 0:
classes = list()
for cclass in commission_list['class']:
commission_class = {
"title": cclass['title']
}
if len(commission_list['price']) > 0:
prices = list()
for cprice in (i for i in commission_list['price'] if i['classid'] == cclass['classid']):
if 'a' in cprice['settings']:
ptype = 'additional'
else:
ptype = 'base'
price = {
"title": cprice['title'],
"price_min": self.convert_commission_price(cprice['amount_min'], cprice['settings']),
"price_max": self.convert_commission_price(cprice['amount_min'], cprice['settings']),
'price_type': ptype
}
prices.append(price)
commission_class['prices'] = prices
classes.append(commission_class)
commissions['price_classes'] = classes
user['commission_info'] = commissions
user['relationship'] = profile.select_relation(userid, otherid) if userid else None
if 'O' in o_config:
submissions = collection.select_list(
userid, rating, 11, otherid=otherid, options=["cover"], config=u_config)
more_submissions = 'collections'
featured = None
elif 'A' in o_config:
submissions = character.select_list(
userid, rating, 11, otherid=otherid, options=["cover"], config=u_config)
more_submissions = 'characters'
featured = None
else:
submissions = submission.select_list(
userid, rating, 11, otherid=otherid, options=["cover"], config=u_config,
profile_page_filter=True)
more_submissions = 'submissions'
featured = submission.select_featured(userid, otherid, rating)
if submissions:
submissions = map(tidy_submission, submissions)
user['recent_submissions'] = submissions
user['recent_type'] = more_submissions
if featured:
featured = tidy_submission(featured)
user['featured_submission'] = featured
statistics = profile.select_statistics(otherid)
if statistics:
statistics.pop('staff_notes')
user['statistics'] = statistics
user_info = profile.select_userinfo(otherid)
if user_info:
if not user_info['show_age']:
user_info['age'] = None
user_info.pop('show_age', None)
user_info.pop('birthday', None)
user_info['location'] = user_info.pop('country', None)
user['user_info'] = user_info
user['link'] = d.absolutify_url("/~" + user['login_name'])
return json.dumps(user)
开发者ID:0x15,项目名称:weasyl,代码行数:101,代码来源:api.py
示例9: favorites_
def favorites_(request):
def _FEATURE(target):
if target == "submit":
return 10
elif target == "char":
return 20
elif target == "journal":
return 30
else:
return 0
form = request.web_input(userid="", name="", feature="", backid=None, nextid=None)
form.name = request.matchdict.get('name', form.name)
form.userid = define.get_int(form.userid)
config = define.get_config(request.userid)
rating = define.get_rating(request.userid)
otherid = profile.resolve(request.userid, form.userid, form.name)
# TODO(hyena): Why aren't more of these WeasylErrors?
if not otherid:
raise WeasylError("userRecordMissing")
elif not request.userid and "h" in define.get_config(otherid):
return Response(define.errorpage(request.userid, errorcode.no_guest_access))
elif request.userid != otherid and 'v' in define.get_config(otherid):
return Response(define.errorpage(
request.userid,
"You cannot view this page because the owner does not allow anyone to see their favorites."))
userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)
has_fullname = userprofile['full_name'] is not None and userprofile['full_name'].strip() != ''
page_title = u"%s's favorites" % (userprofile['full_name'] if has_fullname else userprofile['username'],)
page = define.common_page_start(request.userid, title=page_title)
if form.feature:
nextid = define.get_int(form.nextid)
backid = define.get_int(form.backid)
url_format = (
"/favorites?userid={userid}&feature={feature}&%s".format(userid=userprofile['userid'], feature=form.feature))
id_field = form.feature + "id"
count_function = None
if form.feature == "submit":
select_function = favorite.select_submit
count_function = favorite.select_submit_count
elif form.feature == "char":
select_function = favorite.select_char
elif form.feature == "journal":
select_function = favorite.select_journal
else:
raise httpexceptions.HTTPNotFound()
faves = pagination.PaginatedResult(
select_function, count_function,
id_field, url_format, request.userid, rating, 60,
otherid=otherid, backid=backid, nextid=nextid, config=config)
else:
faves = {
"submit": favorite.select_submit(request.userid, rating, 22, otherid=otherid, config=config),
"char": favorite.select_char(request.userid, rating, 22, otherid=otherid, config=config),
"journal": favorite.select_journal(request.userid, rating, 22, otherid=otherid, config=config),
}
page.append(define.render('user/favorites.html', [
# Profile information
userprofile,
# User information
profile.select_userinfo(otherid, config=userprofile['config']),
# Relationship
profile.select_relation(request.userid, otherid),
# Feature
form.feature,
# Favorites
faves,
]))
return Response(define.common_page_end(request.userid, page))
开发者ID:Syfaro,项目名称:weasyl,代码行数:77,代码来源:profile.py
示例10: profile_
def profile_(request):
form = request.web_input(userid="", name="")
form.name = request.matchdict.get('name', form.name)
form.userid = define.get_int(form.userid)
config = define.get_config(request.userid)
rating = define.get_rating(request.userid)
otherid = profile.resolve(request.userid, form.userid, form.name)
if not otherid:
raise WeasylError("userRecordMissing")
userprofile = profile.select_profile(otherid, images=True, viewer=request.userid)
extras = {
"canonical_url": "/~" + define.get_sysname(form.name)
}
if not request.userid:
# Only generate the Twitter/OGP meta headers if not authenticated (the UA viewing is likely automated).
twit_card = profile.twitter_card(otherid)
if define.user_is_twitterbot():
extras['twitter_card'] = twit_card
# The "og:" prefix is specified in page_start.html, and og:image is required by the OGP spec, so something must be in there.
extras['ogp'] = {
'title': twit_card['title'],
'site_name': "Weasyl",
'type': "website",
'url': twit_card['url'],
'description': twit_card['description'],
'image': twit_card['image:src'] if 'image:src' in twit_card else define.cdnify_url('/static/images/logo-mark-light.svg'),
}
if not request.userid and "h" in userprofile['config']:
return Response(define.errorpage(
request.userid,
"You cannot view this page because the owner does not allow guests to view their profile.",
**extras))
has_fullname = userprofile['full_name'] is not None and userprofile['full_name'].strip() != ''
extras['title'] = u"%s's profile" % (userprofile['full_name'] if has_fullname else userprofile['username'],)
page = define.common_page_start(request.userid, **extras)
define.common_view_content(request.userid, otherid, "profile")
if 'O' in userprofile['config']:
submissions = collection.select_list(
request.userid, rating, 11, otherid=otherid, options=["cover"], config=config)
more_submissions = 'collections'
featured = None
elif 'A' in userprofile['config']:
submissions = character.select_list(
request.userid, rating, 11, otherid=otherid, options=["cover"], config=config)
more_submissions = 'characters'
featured = None
else:
submissions = submission.select_list(
request.userid, rating, 11, otherid=otherid, options=["cover"], config=config,
profile_page_filter=True)
more_submissions = 'submissions'
featured = submission.select_featured(request.userid, otherid, rating)
if userprofile['show_favorites_bar']:
favorites = favorite.select_submit(request.userid, rating, 11, otherid=otherid, config=config)
else:
favorites = None
statistics, show_statistics = profile.select_statistics(otherid)
page.append(define.render('user/profile.html', [
# Profile information
userprofile,
# User information
profile.select_userinfo(otherid, config=userprofile['config']),
macro.SOCIAL_SITES,
# Relationship
profile.select_relation(request.userid, otherid),
# Myself
profile.select_myself(request.userid),
# Recent submissions
submissions, more_submissions,
favorites,
featured,
# Folders preview
folder.select_preview(request.userid, otherid, rating, 3),
# Latest journal
journal.select_latest(request.userid, rating, otherid=otherid, config=config),
# Recent shouts
shout.select(request.userid, ownerid=otherid, limit=8),
# Statistics information
statistics,
show_statistics,
# Commission information
commishinfo.select_list(otherid),
# Friends
lambda: frienduser.has_friends(otherid),
]))
return Response(define.common_page_end(request.userid, page))
开发者ID:Weasyl,项目名称:weasyl,代码行数:99,代码来源:profile.py
注:本文中的weasyl.profile.select_userinfo函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论