Example #1
0
 def messages(self,localusername,remoteusername=None):
     conf = cherrypy.request.app.config['swizzler']
     twister = Twister(conf['rpc_url'],format_twist)
     localuser = twister.get_user_info(localusername)
     remoteuser = remoteusername and twister.get_user_info(remoteusername) or None
     threads = remoteusername and twister.get_user_messages(localusername,remoteusername,conf['num_messages']) or twister.get_user_messages(localusername)
     result = {
         'is_messages':True,
         'title':u"{0} (@{1}): direct messages{2}".format(
             localuser['fullname'],localuser['username'],
             remoteuser and u" with {fullname} (@{username}) - Swizzler".format(**remoteuser) or ""),
         'subject':localuser,
         'remoteuser':remoteuser,
         'threads':threads,
         'any_threads':not not threads,
         'local_users':twister.local_user_menu()['users'],
         'info':twister.get_info(),
         'site_root':cherrypy.request.base+cherrypy.request.script_name,
     }
     return stache.render(stache.load_template('messages'),result)
Example #2
0
 def user_embed(self,username='******',style='normal'):
     if username=='nobody': username='' # to enable /nobody/large
     conf = cherrypy.request.app.config['swizzler']
     twister = Twister(conf['rpc_url'],format_twist)
     result = {
         'title':'@{0} - Swizzler'.format(username),
         'site_root':cherrypy.request.base+cherrypy.request.script_name,
         'user':twister.get_user_info(username)
     }
     result['style_{0}'.format(style)] = True
     return stache.render(stache.load_template('user-iframe'),result)
Example #3
0
 def user(self,username='******'):
     if username=='nobody':
         raise cherrypy.HTTPRedirect('/') # promoted posts are nobody's profile
     conf = cherrypy.request.app.config['swizzler']
     twister = Twister(conf['rpc_url'],format_twist)
     user = twister.get_user_info(username)
     messages = twister.get_user_posts(username,conf['num_messages'])
     result = {
         'is_user':True,
         'title':u"{fullname} (@{username}): Profile - Swizzler".format(**user),
         'subject':user,
         'messages':messages,
         'any_messages':not not messages,
         'local_users':twister.local_user_menu()['users'],
         'info':twister.get_info(),
         'site_root':cherrypy.request.base+cherrypy.request.script_name,
     }
     return stache.render(stache.load_template('standard'),result)