Exemple #1
0
def detail(request, slug, version=None):
    try:
        import pysvn
    except ImportError:
        raise Http404("PySVN not found")
    else:
        client, version, docroot = _get_svnroot(version, settings.DOCS_SVN_PATH)

        docpath = urlparse.urljoin(docroot, slug+".txt")
        try:
            name, info = client.info2(docpath)[0]
        except pysvn.ClientError:
            raise Http404("Invalid doc: %r (version %r)" % (slug, version))

        parts = builder.build_document(client.cat(docpath))
        template_list = ["documentation/%s_detail.html" % version, "documentation/detail.html"]
        context = {
            "doc": parts,
            "revision": info.rev.number,
            "all_versions": Release.objects.all(),
            "slug": slug,
            "version": version,
            "update_date": datetime.datetime.fromtimestamp(info.last_changed_date),
        }
        return render_to_response(template_list, context, RequestContext(request, {}))
Exemple #2
0
def get_absolute_document_urls():
    """
    Returns a list of document slugs available in the SVN.
    """
    all_docs = []
    for release in Release.objects.all():
        client, version, docroot = _get_svnroot(release.version, settings.DOCS_SVN_PATH)
        doclist = client.ls(docroot, recurse=False)
        doclist = [os.path.splitext(os.path.basename(doc.name))[0] for doc in doclist]
        doclist.sort()
        all_docs.extend(["/documentation/%s/" % doc for doc in doclist])
    return tuple(all_docs)