diff --git a/pygit/pygit.py b/pygit/pygit.py index 57a2280..4db66f7 100644 --- a/pygit/pygit.py +++ b/pygit/pygit.py @@ -1,17 +1,17 @@ -from os.path import basename +from os.path import basename,dirname,exists from git import * -REPOS = ['/home/portnov/www/projects', - '/home/portnov/www/projects/mgmt/hms', - '/home/portnov/git/pylambda'] +# sys.path.append(dirname(dirname(__file__))) +# from settings import REPOS +from django.conf import settings rp = None curr_path = None def open_repo(rid): global curr_path,rp - path = REPOS[int(rid)] + path = settings.REPOS[int(rid)] # if rp and curr_path==path: # return rp curr_path = path @@ -27,7 +27,7 @@ def dirs(tree): return [(tree.id,tree.name) for tree in contents if tree.__class__.__name__=='Tree'] def repos(): - return [(i,basename(REPOS[i])) for i in range(len(REPOS))] + return [(i,basename(settings.REPOS[i])) for i in range(len(settings.REPOS))] def description(rid): r = open_repo(rid) @@ -45,6 +45,16 @@ def date(tp): y,m,d,h,M,s,_,_,_ = tp return "%d.%d.%d %d:%d:%d" % (d,m,y,h,M,s) +def tarball(rid,tid): + r = open_repo(rid) + path = "/media/tarballs/archive-%s-%s.tar.gz" % (rid,tid) + if not exists(path): + f = open(path,'w') + targz = r.archive_tar_gz(tid) + f.write(targz) + f.close() + return path + def commits(rid,branch='master'): r = open_repo(rid) cs = r.commits(branch) @@ -93,21 +103,6 @@ def diff_path(rid,path,cid1,cid2=None): ds = Commit.diff(r,c2,c1) return [(d.a_path,d.diff) for d in ds if d.a_path==path] -def uniq(lst): - r = [] - count = 0 - lst.sort() - prev = lst[0] - for item in lst: - if item == prev: - count += 1 - else: - r.append((prev,count)) - count = 1 - prev = item - r.append((prev,count)) - return r - def group_by_date(lst): "[Commit] -> [(date,Commit)]" def date(tp): diff --git a/run-fastcgi b/run-fastcgi index e1dced1..2f4e1ab 100755 --- a/run-fastcgi +++ b/run-fastcgi @@ -13,5 +13,5 @@ fi exec /usr/bin/env - \ PYTHONPATH="../python:.." \ - ./manage.py runfcgi socket=$SOCKET pidfile=$PIDFILE + ./manage.py runfcgi method=threaded socket=$SOCKET pidfile=$PIDFILE diff --git a/settings.py b/settings.py index 9e3c2bb..cb5d872 100644 --- a/settings.py +++ b/settings.py @@ -107,3 +107,8 @@ MENU_ANONYMOUS = [(u'Главная','/'), MENU_USER = [(u'Главная','/'), (u'Git', '/git'), (u'Выход', '/logout/')] + +REPOS = ['/home/portnov/www/projects', + '/home/portnov/www/projects/mgmt/hms', + '/home/portnov/git/pylambda'] + diff --git a/templates/document.html b/templates/document.html index a3f13cd..b985ddf 100644 --- a/templates/document.html +++ b/templates/document.html @@ -1,4 +1,5 @@ {% extends "base.html" %} +{% load prj_filters %} {%block title%}Документ: {{document.name}}{%endblock%} @@ -13,7 +14,7 @@ <p>Проект: <a href='{% url mgmt.views.one_project document.project.id %}'>{{document.project.name}}</a></p> <div class='document'> - {{document.text}} + {{document.text|markdown|safe}} </div> {% include "comments.html" %} diff --git a/templates/project_body.html b/templates/project_body.html index 0ce5dac..692a709 100644 --- a/templates/project_body.html +++ b/templates/project_body.html @@ -1,7 +1,8 @@ + {% load prj_filters %} <div class='project'> <p><strong><a href='{% url mgmt.views.one_project project.id %}'>{{ project.name }}</a></strong></p> <p><strong>Репозиторий: </strong> {{ project.repo }}</p> - <p>{{ project.text }}</p> + <p>{{ project.text|markdown|safe }}</p> <p class='links'> <a href='{% url mgmt.views.project_documents project.id %}'>Документация</a> <a href='{% url mgmt.views.project_bugs project.id %}'>Баги</a>