diff options
Diffstat (limited to 'bn_django/git_browse/views.py')
-rw-r--r-- | bn_django/git_browse/views.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py new file mode 100644 index 0000000..c0966b0 --- /dev/null +++ b/bn_django/git_browse/views.py @@ -0,0 +1,28 @@ +from django.conf import settings +from django import forms, http, template +from django.contrib.auth.decorators import login_required +from django.shortcuts import get_object_or_404, render_to_response +from django.http import HttpResponse + +import os, commands + +from models import * + +try: + GITBROWSE_BASE = settings.GITBROWSE_BASE+'/' +except AttributeError: + GITBROWSE_BASE='/home/' + + +# Create your views here. + +def repo_view(request, repo): + therepo = get_object_or_404(Repository, slug=repo) + out_content = 'Repo path: ' + therepo.path + '\n' + out_content += 'Repo slug: ' + therepo.slug + '\n\n\n\n\n' + + out_content += commands.getoutput('cd '+GITBROWSE_BASE+therepo.slug+'; /usr/local/bin/git --git-dir='+GITBROWSE_BASE+therepo.slug+'/.git ls-files') + + return render_to_response('git_browse/repository_raw_output.html', + dict(object=therepo,raw_content=out_content)) + |