Beispiel #1
0
    def get(self):
        method = self.request.get('method')
        logging.debug(method)
        
        if method == "photo.list.all":
            doc = Document()
            root = doc.createElement("channel")
            doc.appendChild(root)

            obj_contents = photolog_list_all('',5)
            for obj in obj_contents:
                dom = parseString(obj.to_xml().encode('utf-8'))
                root.appendChild(dom.getElementsByTagName("entity")[0])
        elif method == "user.info":
            doc = Document()
            root = doc.createElement("channel")
            doc.appendChild(root)

            key = method = self.request.get('key')
            userinfo = get_user_by_key(key)
            dom = parseString(userinfo.to_xml().encode('utf-8'))
            root.appendChild(dom.getElementsByTagName("entity")[0])
        elif method == "photo.one":
            gkey = self.request.get('gkey')
            if gkey:
                obj = photolog_get_node(gkey)
                doc = obj.get_info_in_xml()
                #dom = parseString(obj.to_xml().encode('utf-8'))
                #root.appendChild(dom.getElementsByTagName("entity")[0])
            else:
                return
            
        self.response.out.write(doc.toxml())
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'))
Beispiel #3
0
def photolog_content_view(handler):
        fbuser = get_current_user(handler)

        thisNode = photolog_get_node(handler.request.get('gkey'))
        rnodes = photolog_get_related_node(handler.request.get('gkey'))
        
        out_str = ' '.join(thisNode.tags)

        template_values = {
            'current_fb_user' : fbuser,
            'facebook_app_id' : config.FACEBOOK_APP_ID,
            'google_ad_client' : config.GOOGLE_AD_CLIENT,
            'google_ad_slot' : config.GOOGLE_AD_SLOT,
            'disqus_id' : config.DISQUS_ID,
            'thisNode' : thisNode,
            'tagstr' : out_str,
            'rnodes' : rnodes,
            'ip_addr' : handler.request.remote_addr,
        }
        path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,MAIN_CONTENT_VIEW)
        handler.response.out.write(template.render(path, template_values).decode('utf-8'))
Beispiel #4
0
def photolog_add_entry_view(handler):
        fbuser = get_current_user(handler)
        
        if not fbuser:
            template_values = {
                'redirect_url' : handler.request.path,
                'facebook_app_id' : config.FACEBOOK_APP_ID
                }
            path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,LOGIN_PAGE)
        else:
            if(handler.request.get('pkey')):
                thisNode = photolog_get_node(handler.request.get('pkey'))
            else:
                thisNode = None

            template_values = {
                'current_fb_user' : fbuser,
                'facebook_app_id' : config.FACEBOOK_APP_ID,
                'pnode' : thisNode,
                'ip_addr' : handler.request.remote_addr,
                }
            path = os.path.join(os.path.dirname(__file__),TEMPLATE_DIR,ADD_VIEW)
        handler.response.out.write(template.render(path, template_values).decode('utf-8'))