~dylanmccall/harvest/gsoc-client-stuff

« back to all changes in this revision

Viewing changes to harvest/common/context_processors.py

  • Committer: Dylan McCall
  • Date: 2010-07-14 19:33:14 UTC
  • Revision ID: dylanmccall@gmail.com-20100714193314-s0rnb3eyzeqxjxq5
Tidier, slightly more stylish Python, with a bit of redundancy removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
def harvest_version(request):
4
4
    """
5
 
    add the harvest version to template context processor. 
 
5
    add the version number and name to template context processor 
6
6
    """
7
7
    try:
8
8
        version = settings.VERSION_STRING
9
9
    except AttributeError:
10
10
        version = "unknown"
11
 
 
12
 
    return {'harvest_version': version}
13
 
 
14
 
def harvest_version_name(request):
15
 
    """
16
 
    add short harvest version name to template context processor
17
 
    """
 
11
    
18
12
    try:
19
13
        version_name = settings.VERSION_NAME_STRING
20
14
    except AttributeError:
21
15
        version_name = ""
22
16
 
23
 
    return {'harvest_version_name': version_name}
 
17
    return {'harvest_version': version,
 
18
            'harvest_version_name': version_name}
24
19
 
25
20
def login_redirect(request):
26
21
    return {'login_next': request.get_full_path()}