Source

freehg / context_processors.py

Full commit
from django import get_version as django_version
from mercurial import __version__ as hg_version
from sys import version_info

def softwaresVersions(request):
    def py_version():
        v = "%s.%s.%s" % version_info[:3]
        
        if version_info[3] != "final":
            v += ".%s" % version_info[3]
        
        return v
    
    versions = dict()
    versions["django_version"] = django_version()
    versions["hg_version"] = hg_version.version
    versions["py_version"] = py_version()
     
    return versions

def customLinks(request):
    class Link(object):
        def __init__(self):
            self.url = ""
            self.label = ""
        
    links = list()
    
    link = Link()
    link.url = "/about"
    link.label = "About"
    links.append(link)
    
    link = Link()
    link.url = "/tos"
    link.label = "T.O.S"
    links.append(link)
    
    link = Link()
    link.url = "/workflow"
    link.label = "Workflow"
    links.append(link)
    
    return {"custom_links": links}