示例#1
0
def no_menu(request, template_name):
    if request.method != "GET": return uic.methodNotAllowed(request)
    d = {'menu_item': 'ui_home.null'}
    try:
        loader.get_template('info/' + template_name + ".html")
    except:
        return uic.error(request, 404)
    return uic.render(request, 'info/' + template_name, d)
示例#2
0
def download_error(request):
    """
  Download link error
  """
    #. Translators: Copy HTML tags over and only translate words outside of these tags
    #. i.e.: <a class="don't_translate_class_names" href="don't_translate_urls">Translate this text</a>
    content = [_("If you have recently requested a batch download of your identifiers, ") +\
      _("the file may not be complete. Please close this window, then try the download ") +\
      _("link again in a few minutes."),
      _("If you are trying to download a file of identifiers from a link that was ") +\
      _("generated over seven days ago, the download link has expired. Go to ") +\
      "<a class='link__primary' href='/manage'>" +\
      _("Manage IDs") + "</a> " +\
      _("and click &quot;Download All&quot; to generate a new download link."),
      _("Please <a class='link__primary' href='/contact'>contact us</a> if you need ") +\
      _("assistance.")]
    return uic.error(request, 404, content)
示例#3
0
def doc(request):
    """
  Renders UTF-8 encoded HTML documentation and plain text Python code
  files.
  """
    if request.method != "GET": return uic.methodNotAllowed(request)
    assert request.path_info.startswith("/doc/")
    file = request.path_info[5:]
    path = os.path.join(django.conf.settings.PROJECT_ROOT, "templates", "doc",
                        file)
    if os.path.exists(path):
        if file.endswith(".html"):
            return uic.render(request, os.path.join("doc", file[:-5]),
                              {"menu_item": "ui_home.learn"})
        else:
            f = open(path)
            content = f.read()
            f.close()
            return uic.staticTextResponse(content)
    else:
        return uic.error(request, 404)