def GET(self, name=""): cachename = "user/following.html" 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) return define.webpage(self.user_id, cachename, [ # Profile information userprofile, # User information profile.select_userinfo(otherid, config=userprofile['config']), # Relationship profile.select_relation(self.user_id, otherid), # Following followuser.select_following(self.user_id, otherid, limit=44, backid=define.get_int(form.backid), nextid=define.get_int(form.nextid)), ])
def following_(request): name = request.matchdict.get('name', request.params.get('name', '')) userid = define.get_int(request.params.get('userid')) otherid = profile.resolve(request.userid, userid, name) backid = request.params.get('backid') nextid = request.params.get('nextid') if not otherid: raise WeasylError("userRecordMissing") elif not request.userid and "h" in define.get_config(otherid): raise WeasylError('noGuests') userprofile = profile.select_profile(otherid, viewer=request.userid) return Response( define.webpage( request.userid, "user/following.html", [ # Profile information userprofile, # User information profile.select_userinfo(otherid, config=userprofile['config']), # Relationship profile.select_relation(request.userid, otherid), # Following followuser.select_following(request.userid, otherid, limit=44, backid=define.get_int(backid), nextid=define.get_int(nextid)), ]))
def following_(request): cachename = "user/following.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), # Following followuser.select_following(request.userid, otherid, limit=44, backid=define.get_int(form.backid), nextid=define.get_int(form.nextid)), ]))
def GET(self, name=""): cachename = "user/following.html" 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) return define.webpage( self.user_id, cachename, [ # Profile information userprofile, # User information profile.select_userinfo(otherid, config=userprofile['config']), # Relationship profile.select_relation(self.user_id, otherid), # Following followuser.select_following(self.user_id, otherid, limit=44, backid=define.get_int(form.backid), nextid=define.get_int( form.nextid)), ])
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 define.user_is_twitterbot(): extras['twitter_card'] = profile.twitter_card(otherid) extras['options'] = ['nocache'] 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 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 profile.select_statistics(otherid), # Commission information commishinfo.select_list(otherid), # Friends frienduser.select(request.userid, otherid, 5, choose=None), # Following followuser.select_following(request.userid, otherid, choose=5), # Followed followuser.select_followed(request.userid, otherid, choose=5), ])) return Response(define.common_page_end(request.userid, page))
def GET(self, name=""): now = time.time() form = web.input(userid="", name="") form.name = name if name else form.name form.userid = define.get_int(form.userid) config = define.get_config(self.user_id) rating = define.get_rating(self.user_id) otherid = profile.resolve(self.user_id, form.userid, form.name) if not otherid: raise WeasylError("userRecordMissing") userprofile = profile.select_profile(otherid, images=True, viewer=self.user_id) extras = { "canonical_url": "/~" + define.get_sysname(form.name) } if define.user_is_twitterbot(): extras['twitter_card'] = profile.twitter_card(otherid) extras['options'] = ['nocache'] if not self.user_id and "h" in userprofile['config']: return define.errorpage( self.user_id, "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(self.user_id, **extras) define.common_view_content(self.user_id, otherid, "profile") if 'O' in userprofile['config']: submissions = collection.select_list( self.user_id, rating, 11, otherid=otherid, options=["cover"], config=config) more_submissions = 'collections' featured = None elif 'A' in userprofile['config']: submissions = character.select_list( self.user_id, rating, 11, otherid=otherid, options=["cover"], config=config) more_submissions = 'characters' featured = None else: submissions = submission.select_list( self.user_id, rating, 11, otherid=otherid, options=["cover"], config=config, profile_page_filter=True) more_submissions = 'submissions' featured = submission.select_featured(self.user_id, otherid, rating) if userprofile['show_favorites_bar']: favorites = favorite.select_submit(self.user_id, rating, 11, otherid=otherid, config=config) else: favorites = None page.append(define.render(template.user_profile, [ # Profile information userprofile, # User information profile.select_userinfo(otherid, config=userprofile['config']), macro.SOCIAL_SITES, # Relationship profile.select_relation(self.user_id, otherid), # Myself profile.select_myself(self.user_id), # Recent submissions submissions, more_submissions, favorites, featured, # Folders preview folder.select_preview(self.user_id, otherid, rating, 3), # Latest journal journal.select_latest(self.user_id, rating, otherid=otherid, config=config), # Recent shouts shout.select(self.user_id, ownerid=otherid, limit=8), # Statistics information profile.select_statistics(otherid), # Commission information commishinfo.select_list(otherid), # Friends frienduser.select(self.user_id, otherid, 5, choose=None), # Following followuser.select_following(self.user_id, otherid, choose=5), # Followed followuser.select_followed(self.user_id, otherid, choose=5), ])) return define.common_page_end(self.user_id, page, now=now)