コード例 #1
0
ファイル: main_tpk.py プロジェクト: pokowaka/pali
 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))
コード例 #2
0
ファイル: mainweb.py プロジェクト: wisperwinter/pali
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)
コード例 #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))
コード例 #4
0
ファイル: mainweb.py プロジェクト: sup6/pali
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)
コード例 #5
0
ファイル: mainweb.py プロジェクト: quytinh/pali
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)