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))