Beispiel #1
0
def photolog_profile_view(handler):
        if handler.request.get('email'):
            fbuser = get_current_user(handler)
            requested_user = get_user_by_id(handler.request.get('email'))
                
            facebook_contents = photolog_get_user_node('facebook',requested_user)
            template_values = {
                'current_fb_user' : fbuser,
                'requested_user' : requested_user,
                'facebook_app_id' : config.FACEBOOK_APP_ID,
                'facebook_contents' : facebook_contents,
                'ip_addr' : handler.request.remote_addr,
                }
            path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,PROFILE_PAGE)
        else:
            fbuser = get_current_user(handler)
            if not fbuser:
                template_values = {
                    'redirect_url' : handler.request.path,
                }
                path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,LOGIN_PAGE)
            else:
                facebook_contents = photolog_get_user_node('facebook',fbuser)

                template_values = {
                    'current_fb_user' : fbuser,
                    'facebook_app_id' : config.FACEBOOK_APP_ID,
                    'facebook_contents' : facebook_contents,
                    'ip_addr' : handler.request.remote_addr,
                    }
                path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,PROFILE_PAGE)

        handler.response.out.write(template.render(path, template_values).decode('utf-8'))
Beispiel #2
0
def photolog_browse_my_list(handler):
        fbuser = get_current_user(handler)
        if not fbuser:
            handler.response.out.write(simplejson.dumps({ 'status' : 'NOK' , 'newkey' : None}))
        else:
            handler.request.get('pkey')
            obj_contents = photolog_get_user_node("facebook",fbuser)
            template_values = {
                'pnode' : photolog_get_node(handler.request.get('pkey')),
                'obj_contents' : obj_contents,
                }
            path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,MY_CONTENT_LIST)
            handler.response.out.write(template.render(path, template_values).decode('utf-8'))