Beispiel #1
0
 def get(self, paliTextPath, translationLocale, translator, urlLocale=None):
   userLocale = getLocale(urlLocale, self.request.headers.get('accept_language'))
   result = checkPath(self.request.path, urlLocale, paliTextPath, userLocale, translationLocale, translator)
   if not result['isValid']:
     self.abort(404)
   template_values = getCommonTemplateValues(self, urlLocale, userLocale)
   template_values['pageHtml'] = result['pageHtml']
   template_values['htmlTitle'] = result['htmlTitle']
   template = jinja_environment.get_template('index.html')
   self.response.out.write(template.render(template_values))
Beispiel #2
0
def commonPage(paliTextPath, translationLocale=None, translator=None, urlLocale=None):
    userLocale = getLocale(urlLocale, web.ctx.env.get("HTTP_ACCEPT_LANGUAGE"))
    result = checkPath(web.ctx.path, urlLocale, paliTextPath, userLocale, translationLocale, translator)
    if not result["isValid"]:
        raise web.notfound()
    template_values = commonTemplateValues(urlLocale, userLocale)
    template_values["pageHtml"] = result["pageHtml"]
    template_values["htmlTitle"] = result["htmlTitle"]
    template = jinja_environment.get_template("index.html")
    return template.render(template_values)
Beispiel #3
0
 def get(self, paliTextPath, translationLocale, translator, urlLocale=None):
     userLocale = getLocale(urlLocale,
                            self.request.headers.get('accept_language'))
     result = checkPath(self.request.path, urlLocale, paliTextPath,
                        userLocale, translationLocale, translator)
     if not result['isValid']:
         self.abort(404)
     template_values = getCommonTemplateValues(self, urlLocale, userLocale)
     template_values['pageHtml'] = result['pageHtml']
     template_values['htmlTitle'] = result['htmlTitle']
     template = jinja_environment.get_template('index.html')
     self.response.out.write(template.render(template_values))
Beispiel #4
0
def commonPage(paliTextPath,
               translationLocale=None,
               translator=None,
               urlLocale=None):
    userLocale = getLocale(urlLocale, web.ctx.env.get('HTTP_ACCEPT_LANGUAGE'))
    result = checkPath(web.ctx.path, urlLocale, paliTextPath, userLocale,
                       translationLocale, translator)
    if not result['isValid']:
        raise web.notfound()
    template_values = commonTemplateValues(urlLocale, userLocale)
    template_values['pageHtml'] = result['pageHtml']
    template_values['htmlTitle'] = result['htmlTitle']
    template = jinja_environment.get_template('index.html')
    return template.render(template_values)
Beispiel #5
0
def commonPage(paliTextPath, translationLocale=None, translator=None, urlLocale=None):
  if web.ctx.host.split(':')[0] == "epalitipitaka.appspot.com":
    # redirect to new domain
    url = "http://tipitaka.online-dhamma.net" + \
          urllib.quote(web.ctx.path.encode('utf-8')) + \
          web.ctx.query
    raise web.redirect(url)

  userLocale = getLocale(urlLocale, web.ctx.env.get('HTTP_ACCEPT_LANGUAGE'))
  result = checkPath(web.ctx.path, urlLocale, paliTextPath,
                     userLocale, translationLocale, translator)
  if not result['isValid']:
    raise web.notfound()
  template_values = commonTemplateValues(urlLocale, userLocale)
  template_values['pageHtml'] = result['pageHtml']
  template_values['htmlTitle'] = result['htmlTitle']
  template = jinja_environment.get_template('index.html')
  return template.render(template_values)