Exemplo n.º 1
0
 def get(key, languages):
     api = RESTAPI()
     result = api.staticpage_get(key)
     if not result.ok:
         log.warn('Error while fetching static page "%s": %s %s' % (key, result.status_code, result.reason))
         return None
     try:
         page = result.json()
     except JSONDecodeError as e:
         log.warn('Error while decoding static page "%s": %s' % (key, e))
         return None
     if page is None or "errors" in page:
         return None
     data = {
         "lang": u"",
         "title": u"",
         "description": u"",
         "body": u"",
         "column_right": u"",
         "nav": u"",
         "css_classes": [],
         "private": False,
         "redirect_url": u"",
     }
     data.update(page)
     return ExternalStaticPage(key, **data)
Exemplo n.º 2
0
 def get(key, languages):
     api = RESTAPI()
     result = api.staticpage_get(key)
     page = result.json()
     if page is None or 'errors' in page:
         return None
     data = {'lang': u'',
             'title': u'',
             'description': u'',
             'body': u'',
             'column_right': u'',
             'nav': u'',
             'css_classes': [],
             'private': False,
             'redirect_url': u'',
             }
     data.update(page)
     return ExternalStaticPage(key, **data)