def postCache(self, language, query):
        if query.getvalue('blog_post_id'):
            self.currentBlogPost = Blog.getPostById(query.getvalue('blog_post_id'))
        else:
            self.currentBlogPost = Blog.getLatestBlogPost()

        # Twitter feed
        ## http://api.twitter.com/1/statuses/user_timeline.json?screen_name=noradio
        twitterFeedUrl = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=fbonander&count=5&include_rts=true"
        result = urlfetch.fetch(url=twitterFeedUrl)
        if result.status_code == 200:
            self.twitterFeed = json.loads(result.content)
    def postCache(self, language, query):
        if query.getvalue('blog_post_id'):
            self.currentBlogPost = Blog.getPostById(
                query.getvalue('blog_post_id'))
        else:
            self.currentBlogPost = Blog.getLatestBlogPost()

        # Twitter feed
        ## http://api.twitter.com/1/statuses/user_timeline.json?screen_name=noradio
        twitterFeedUrl = "http://api.twitter.com/1/statuses/user_timeline.json?screen_name=fbonander&count=5&include_rts=true"
        result = urlfetch.fetch(url=twitterFeedUrl)
        if result.status_code == 200:
            self.twitterFeed = json.loads(result.content)
Example #3
0
 def editViewUpdateBlogPost(self, request):
     message = Blog.updateBlogPost(request.get('page_module_string_key'),
                                   request.get('blog_post_string_key'),
                                   request.get('language'),
                                   request.get('title'),
                                   request.get('content'))
     return message
    def __init__(self, **kwargs):
        # Get page from kwargs
        page = kwargs['page']
        # Set reference to page.key()
        pageKey = page.key()
        # Get pageModules associated with page
        pageModuleList = PageModules.getByPageKey(pageKey)
        pageData = {}
        pageModules = {}
        blogPosts = {}
        # Set up pageModules dict with lang as keys
        for market in Settings.markets:
            pageModules[market['language']] = {}
            blogPosts[market['language']] = []

        for pageModule in pageModuleList:
            pageModules[pageModule.lang] = pageModule
            blogPosts[pageModule.lang] = Blog.getByPageModuleKey(
                pageModule.key())
            # All content data in store in dbContentModules.ContentModules and not in the pageModules them self
            # Get dbContentModules.ContentModules for pageModule
            pageData[pageModule.lang] = ContentModules.getByPageModuleKey(
                pageModule.key())

        # Store all data
        self.blogPosts = blogPosts
        self.pageModules = pageModules
        self.pageKey = pageKey
        self.pageData = self.parsePageData(pageData)
        self.modules = []
    def __init__(self, **kwargs):
        # Get page from kwargs
        page = kwargs['page']
        # Set reference to page.key()
        pageKey = page.key()
        # Get pageModules associated with page
        pageModuleList = PageModules.getByPageKey(pageKey)
        pageData = {}
        pageModules = {}
        blogPosts = {}
        # Set up pageModules dict with lang as keys
        for market in Settings.markets:
            pageModules[market['language']] = {}
            blogPosts[market['language']] = []

        for pageModule in pageModuleList:
            pageModules[pageModule.lang] = pageModule
            blogPosts[pageModule.lang] = Blog.getByPageModuleKey(pageModule.key())
            # All content data in store in dbContentModules.ContentModules and not in the pageModules them self
            # Get dbContentModules.ContentModules for pageModule
            pageData[pageModule.lang] = ContentModules.getByPageModuleKey(pageModule.key())

        # Store all data
        self.blogPosts = blogPosts
        self.pageModules = pageModules
        self.pageKey = pageKey
        self.pageData = self.parsePageData(pageData)
        self.modules = []
 def preRender(self, query):
     if query.getvalue('blog_post_id'):
         self.currentBlogPost = Blog.getPostById(
             query.getvalue('blog_post_id'))
     else:
         self.currentBlogPost = Blog.getLatestBlogPost()
 def preRender(self, query):
     if query.getvalue('blog_post_id'):
         self.currentBlogPost = Blog.getPostById(query.getvalue('blog_post_id'))
     else:
         self.currentBlogPost = Blog.getLatestBlogPost()
 def editViewUpdateBlogPost(self, request):
     message = Blog.updateBlogPost(request.get('page_module_string_key'), request.get('blog_post_string_key'), request.get('language'), request.get('title'), request.get('content'))
     return message