Example #1
0
File: url.py Project: quytinh/pali
def serveContrastReadingPageHtml(reqPath, urlLocale, paliTextPath, userLocale,
                                 translationLocale, translator):
  result = isValidPath(paliTextPath, translationLocale, translator)
  if result['isValid']:
    data = { 'title': getHtmlTitle(urlLocale, result['texts'], userLocale,
                                   translator, False),
             'html': getContrastReadingPageHtml(translationLocale, translator,
                         result['node']['action'], reqPath, userLocale) }
    return data
Example #2
0
File: url.py Project: sup6/pali
def serveContrastReadingPageHtml(reqPath, urlLocale, paliTextPath, userLocale,
                                 translationLocale, translator):
  result = isValidPath(paliTextPath, translationLocale, translator)
  if result['isValid']:
    data = { 'title': getHtmlTitle(urlLocale, result['texts'], userLocale,
                                   translator, False),
             'html': getContrastReadingPageHtml(translationLocale, translator,
                         result['node']['action'], reqPath, userLocale) }
    return data
Example #3
0
File: url.py Project: quytinh/pali
def checkPath(reqPath, urlLocale, paliTextPath, userLocale,
              translationLocale=None, translator=None):
  result = isValidPath(paliTextPath, translationLocale, translator)
  if result['isValid']:
    # this is a valid path
    if translationLocale:
      if reqPath.endswith('ContrastReading'):
        # contrast reading page
        result['htmlTitle'] = getHtmlTitle(urlLocale, result['texts'],
                                userLocale, translator, True)
        result['pageHtml'] = getContrastReadingPageHtml(translationLocale,
          translator, result['node']['action'], reqPath, userLocale)
      else:
        # translation page
        result['htmlTitle'] = getHtmlTitle(urlLocale, result['texts'],
                                userLocale, translator, False)
        result['pageHtml'] = getTranslationPageHtml(translationLocale,
          translator, result['node']['action'], reqPath, userLocale)
    else:
      # canon page
      result['htmlTitle'] = getHtmlTitle(urlLocale, result['texts'], userLocale)
      result['pageHtml'] = getCanonPageHtml(result['node'], reqPath, userLocale)

  return result
Example #4
0
File: url.py Project: sup6/pali
def checkPath(reqPath, urlLocale, paliTextPath, userLocale,
              translationLocale=None, translator=None):
  result = isValidPath(paliTextPath, translationLocale, translator)
  if result['isValid']:
    # this is a valid path
    if translationLocale:
      if reqPath.endswith('ContrastReading'):
        # contrast reading page
        result['htmlTitle'] = getHtmlTitle(urlLocale, result['texts'],
                                userLocale, translator, True)
        result['pageHtml'] = getContrastReadingPageHtml(translationLocale,
          translator, result['node']['action'], reqPath, userLocale)
      else:
        # translation page
        result['htmlTitle'] = getHtmlTitle(urlLocale, result['texts'],
                                userLocale, translator, False)
        result['pageHtml'] = getTranslationPageHtml(translationLocale,
          translator, result['node']['action'], reqPath, userLocale)
    else:
      # canon page
      result['htmlTitle'] = getHtmlTitle(urlLocale, result['texts'], userLocale)
      result['pageHtml'] = getCanonPageHtml(result['node'], reqPath, userLocale)

  return result
Example #5
0
File: url.py Project: quytinh/pali
def serveCanonPageHtml(reqPath, urlLocale, paliTextPath, userLocale):
  result = isValidPath(paliTextPath)
  if result['isValid']:
    data = { 'title': getHtmlTitle(urlLocale, result['texts'], userLocale),
             'html': getCanonPageHtml(result['node'], reqPath, userLocale) }
    return data
Example #6
0
File: url.py Project: sup6/pali
def serveCanonPageHtml(reqPath, urlLocale, paliTextPath, userLocale):
  result = isValidPath(paliTextPath)
  if result['isValid']:
    data = { 'title': getHtmlTitle(urlLocale, result['texts'], userLocale),
             'html': getCanonPageHtml(result['node'], reqPath, userLocale) }
    return data