aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@animus.robocracy.org>2007-02-24 21:39:51 -0800
committerBryan Newbold <bnewbold@animus.robocracy.org>2007-02-24 21:39:51 -0800
commitc69b55610e3cceb5cbd48784fb7cc0458d463f3a (patch)
treee826ef345f257fce2d627af810d6e364d10de201
parent71520ba4e171195c983320b9c00e37c215fad39c (diff)
downloadbnewnet-c69b55610e3cceb5cbd48784fb7cc0458d463f3a.tar.gz
bnewnet-c69b55610e3cceb5cbd48784fb7cc0458d463f3a.zip
Revert "i'm confused?"
This reverts commit 71520ba4e171195c983320b9c00e37c215fad39c.
-rw-r--r--bn_django/git_browse/models.py36
-rw-r--r--bn_django/git_browse/settings.py7
-rw-r--r--bn_django/git_browse/templates/git_browse/base.html2
-rw-r--r--bn_django/git_browse/templates/git_browse/blob.html2
-rw-r--r--bn_django/git_browse/templates/git_browse/commit.html2
-rw-r--r--bn_django/git_browse/templates/git_browse/full_log.html2
-rw-r--r--bn_django/git_browse/views.py19
-rw-r--r--bn_django/git_wiki/models.py12
-rw-r--r--bn_django/git_wiki/settings.py6
-rw-r--r--bn_django/git_wiki/templates/git_wiki/base.html5
-rw-r--r--bn_django/git_wiki/templates/git_wiki/item.html4
-rw-r--r--bn_django/photos/templates/photos/base.html4
-rw-r--r--bn_django/photos/templates/photos/gallery_detail.html4
-rw-r--r--bn_django/photos/templates/photos/gallery_list.html1
-rw-r--r--bn_django/photos/templates/photos/photo_detail.html5
-rw-r--r--bn_django/settings.py21
-rw-r--r--bn_django/templates/about.html2
-rw-r--r--bn_django/templates/base.html2
18 files changed, 61 insertions, 75 deletions
diff --git a/bn_django/git_browse/models.py b/bn_django/git_browse/models.py
index 315365a..c914cac 100644
--- a/bn_django/git_browse/models.py
+++ b/bn_django/git_browse/models.py
@@ -2,13 +2,6 @@ from django.db import models
from django.conf import settings
try:
- GITBROWSE_BASE = settings.GITBROWSE_BASE
-except AttributeError:
- GITBROWSE_BASE='/home'
-if GITBROWSE_BASE[-1] != '/':
- GITBROWSE_BASE += '/'
-
-try:
GITCOMMAND = settings.GITCOMMAND
except AttributeError:
GITCOMMAND='git'
@@ -23,11 +16,14 @@ if ADMIN_URL[-1] == '/':
# Create your models here.
class Repository(models.Model):
- path = models.FilePathField("relative path to repository", \
- path=GITBROWSE_BASE,recursive=True,match="^.*\.git$",unique=True, \
+# path = models.FilePathField("relative path to repository", \
+# path=GITBROWSE_BASE,recursive=True,match="\.git$",unique=True, \
+# blank=False)
+ path = models.CharField("path to git dir", maxlength=386, unique=True,\
+ blank=False, default="/srv/git/")
+ name = models.CharField(_("name"), maxlength=80, unique=True)
+ slug = models.SlugField("short description of repo", unique=True,\
blank=False)
- name = models.CharField(_("name"), maxlength=80)
- slug = models.SlugField(prepopulate_from=("path",),unique=True)
git_version = models.CharField(_("git version"), maxlength=100, \
default="git version 1.4.4", blank=True, \
help_text="Output of \'git --version\'")
@@ -46,29 +42,27 @@ class Repository(models.Model):
def getGITPREFIX(self):
"""returns the glued together combination of GITCOMMAND and
GITBROWSE_BASE needed to call git commands on this repository"""
- return 'cd ' + str(GITBROWSE_BASE) + str(self.slug) + '; ' \
- + str(GITCOMMAND) + ' --git-dir=' + str(GITBROWSE_BASE) \
- + str(self.slug) + '/.git '
+ return 'cd ' + str(self.path) + '; ' + str(GITCOMMAND) + ' --git-dir='\
+ + str(self.path)
def scan(self):
import os
GITPREFIX = self.getGITPREFIX()
heads = dict()
- for h in os.listdir(GITBROWSE_BASE + self.slug + '/.git/refs/heads/'):
- f = open(GITBROWSE_BASE + self.slug + '/.git/refs/heads/' + h,'r')
+ for h in os.listdir(self.path + '/refs/heads/'):
+ f = open(self.path + '/refs/heads/' + h,'r')
heads[h.strip()] = f.readline().strip()
f.close()
tags = dict()
- for t in os.listdir(GITBROWSE_BASE + self.slug + '/.git/refs/tags/'):
- f = open(GITBROWSE_BASE + self.slug + '/.git/refs/tags/' + t,'r')
+ for t in os.listdir(self.path + '/refs/tags/'):
+ f = open(self.path + '/refs/tags/' + t,'r')
tags[t.strip()] = f.readline().strip()
f.close()
return (GITPREFIX, heads, tags)
def shortlog(self):
import commands
- GITPREFIX = 'cd ' + GITBROWSE_BASE + self.slug + '; ' + GITCOMMAND \
- + ' --git-dir=' + GITBROWSE_BASE + self.slug + '/.git '
+ GITPREFIX = self.getGITPREFIX()
logtxt = commands.getoutput(GITPREFIX \
+ ' log --relative-date --max-count=6 | cat')
log_items = logtxt.split('\ncommit ')
@@ -195,6 +189,8 @@ class Commit(models.Model):
raw = raw.splitlines()
if len(raw) < 3: return
self.treehash = raw[0].split()[-1].strip()
+ if not raw[1].startswith('parent'):
+ raw.insert(1, 'parent ')
self.parenthash = raw[1][6:].strip()
self.author = raw[2].split()[1]
self.author_date = time.ctime(int(raw[2].split()[-2]))
diff --git a/bn_django/git_browse/settings.py b/bn_django/git_browse/settings.py
index 53799ab..87b957d 100644
--- a/bn_django/git_browse/settings.py
+++ b/bn_django/git_browse/settings.py
@@ -1,7 +1,2 @@
-
-# full path to directory holding all the git repositories (or sys links to
-# the repositories)
-GITBROWSE_BASE = '/srv/git/'
-
# fill path to the git command
-GITCOMMAND = '/usr/bin/git'
+GITCOMMAND = '/usr/local/bin/git'
diff --git a/bn_django/git_browse/templates/git_browse/base.html b/bn_django/git_browse/templates/git_browse/base.html
index c86e03b..89a0139 100644
--- a/bn_django/git_browse/templates/git_browse/base.html
+++ b/bn_django/git_browse/templates/git_browse/base.html
@@ -4,7 +4,7 @@
{{ block.super }}
<link rel="STYLESHEET" type="text/css" href="style/git_browse.css" />
<link rel="STYLESHEET" type="text/css" href="/style/git_browse.css" />
-<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/git_browse.css" />
+<!--<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/git_browse.css" />-->
{% endblock %}
diff --git a/bn_django/git_browse/templates/git_browse/blob.html b/bn_django/git_browse/templates/git_browse/blob.html
index 1fb1437..3730807 100644
--- a/bn_django/git_browse/templates/git_browse/blob.html
+++ b/bn_django/git_browse/templates/git_browse/blob.html
@@ -7,7 +7,7 @@
{{ size|filesizeformat }}<br />
<h3><a href="zip">Download zip</a></h3>
<h3>Raw contents</h3>
- <pre class="large">{{ contents }}</pre>
+ <pre class="large">{{ contents|escape|wordwrap:80 }}</pre>
{% else %}
<h3>No such object: {{ hash }}</h3>
{% endif %} {% endblock %}
diff --git a/bn_django/git_browse/templates/git_browse/commit.html b/bn_django/git_browse/templates/git_browse/commit.html
index 3a1aefd..b4ee4a6 100644
--- a/bn_django/git_browse/templates/git_browse/commit.html
+++ b/bn_django/git_browse/templates/git_browse/commit.html
@@ -22,7 +22,7 @@
<h3>Committer Date</h3>
{{ commit.committer_date }}<br />
{% if commit.rawdiff %}
- <pre class="large">{{ commit.rawdiff }}</pre>
+ <pre class="large">{{ commit.rawdiff|escape|wordwrap:80 }}</pre>
{% else %}No diff{% endif %}
{% else %}
<h3>No such object: {{ hash }}</h3>
diff --git a/bn_django/git_browse/templates/git_browse/full_log.html b/bn_django/git_browse/templates/git_browse/full_log.html
index d2a1311..913a3c4 100644
--- a/bn_django/git_browse/templates/git_browse/full_log.html
+++ b/bn_django/git_browse/templates/git_browse/full_log.html
@@ -11,7 +11,7 @@
<br /><b>Author: </b>{{ item.author }}
<br /><b>Date: </b>{{ item.date }}
<br /><b>Comment: </b>
- <pre class="large">{{ item.comment|wordwrap:80 }}</pre>
+ <pre class="large">{{ item.comment|escape|wordwrap:80 }}</pre>
{% endfor %}
{% endif %}
{% endblock %}
diff --git a/bn_django/git_browse/views.py b/bn_django/git_browse/views.py
index f28aa76..ed653df 100644
--- a/bn_django/git_browse/views.py
+++ b/bn_django/git_browse/views.py
@@ -9,11 +9,6 @@ import os, commands
from models import *
try:
- GITBROWSE_BASE = settings.GITBROWSE_BASE+'/'
-except AttributeError:
- GITBROWSE_BASE='/home/'
-
-try:
GITCOMMAND = settings.GITCOMMAND
except AttributeError:
GITCOMMAND='git'
@@ -41,11 +36,9 @@ def view_tree(request, repo, hash=None,branch=None):
(GITPREFIX, heads, tags) = therepo.scan()
if(hash == None):
- head_ref = commands.getoutput('cd ' + GITBROWSE_BASE \
- + therepo.slug +'/.git; cat HEAD')
+ head_ref = commands.getoutput('cd ' + therepo.path + '; cat HEAD')
head_ref = head_ref.split()[1]
- hash = commands.getoutput('cd ' + GITBROWSE_BASE + therepo.slug \
- +'/.git; cat ' + head_ref)
+ hash = commands.getoutput('cd ' + therepo.path + '; cat ' + head_ref)
tree_ls = commands.getoutput(GITPREFIX + ' ls-tree ' + hash)
tree_objs = list()
@@ -70,9 +63,6 @@ def view_log(request, repo, hash=None):
therepo = get_object_or_404(Repository, slug=repo)
(GITPREFIX, heads, tags) = therepo.scan()
- GITPREFIX = 'cd ' + GITBROWSE_BASE + therepo.slug + '; ' + GITCOMMAND \
- + ' --git-dir=' + GITBROWSE_BASE + therepo.slug + '/.git '
-
logtxt = commands.getoutput(GITPREFIX + ' log | cat')
log_items = logtxt.split('\ncommit ')
if (log_items[0] == ''):
@@ -126,11 +116,6 @@ def view_obj(request, repo, hash, branch=None):
(GITPREFIX, heads, tags) = therepo.scan()
obj_type = commands.getoutput(GITPREFIX + ' cat-file -t ' + hash)
- #if(obj_type == 'tree'):
- # redirect_to('../tree/' + hash);
- #if(obj_type == 'blob'):
- # redirect_to('../blob/' + hash);
-
obj_contents = commands.getoutput(GITPREFIX + ' cat-file -p ' + hash)
obj_size = commands.getoutput(GITPREFIX + ' cat-file -s ' + hash)
diff --git a/bn_django/git_wiki/models.py b/bn_django/git_wiki/models.py
index 0e71fca..11f00f1 100644
--- a/bn_django/git_wiki/models.py
+++ b/bn_django/git_wiki/models.py
@@ -150,10 +150,10 @@ def fromslug(reqslug):
import commands
if reqslug == '' or reqslug == '/':
- f = open(GITWIKI_BASE + '/' + GITWIKI_NAME + '.git/HEAD','r')
+ f = open(GITWIKI_BASE + '/.git/HEAD','r')
head = f.readline().strip().split()[1]
f.close()
- f = open(GITWIKI_BASE + '/' + GITWIKI_NAME + '.git/'+head,'r')
+ f = open(GITWIKI_BASE + '/.git/'+head,'r')
hash = f.readline().strip()
f.close()
ret = Tree(id=hash)
@@ -198,13 +198,13 @@ def fromslug(reqslug):
def reposcan():
import os
heads = dict()
- for h in os.listdir(GITWIKI_BASE + '/' + GITWIKI_NAME + '.git/refs/heads/'):
- f = open(GITWIKI_BASE + '/' + GITWIKI_NAME + '.git/refs/heads/' + h,'r')
+ for h in os.listdir(GITWIKI_BASE + '/.git/refs/heads/'):
+ f = open(GITWIKI_BASE + '/.git/refs/heads/' + h,'r')
heads[h.strip()] = f.readline().strip()
f.close()
tags = dict()
- for t in os.listdir(GITWIKI_BASE + '/' + GITWIKI_NAME + '.git/refs/tags/'):
- f = open(GITWIKI_BASE + '/' + GITWIKI_NAME + '.git/refs/tags/' + t,'r')
+ for t in os.listdir(GITWIKI_BASE + '/.git/refs/tags/'):
+ f = open(GITWIKI_BASE + '/.git/refs/tags/' + t,'r')
tags[t.strip()] = f.readline().strip()
f.close()
return (heads, tags)
diff --git a/bn_django/git_wiki/settings.py b/bn_django/git_wiki/settings.py
index fb81e26..ed07f53 100644
--- a/bn_django/git_wiki/settings.py
+++ b/bn_django/git_wiki/settings.py
@@ -1,13 +1,13 @@
# full path to directory holding the wiki repository (or sys links to
# the repositories)
-GITWIKI_BASE = '/srv/git/'
+GITWIKI_BASE = '/home/bnewbold/knowledge/'
# leave this blank (NO WHITE SPACE) unless you're using a bare repo
-GITWIKI_NAME = 'knowledge'
+GITWIKI_NAME = ''
# fill path to the git command
-GITCOMMAND = '/usr/bin/git'
+GITCOMMAND = '/usr/local/bin/git'
GITPREFIX = 'cd ' +str(GITWIKI_BASE) + '; ' + str(GITCOMMAND) + ' --git-dir=' \
+ str(GITWIKI_BASE) + '/' + GITWIKI_NAME + '.git'
diff --git a/bn_django/git_wiki/templates/git_wiki/base.html b/bn_django/git_wiki/templates/git_wiki/base.html
index ded3c25..eefaa9a 100644
--- a/bn_django/git_wiki/templates/git_wiki/base.html
+++ b/bn_django/git_wiki/templates/git_wiki/base.html
@@ -4,16 +4,13 @@
{{ block.super }}
<link rel="STYLESHEET" type="text/css" href="style/git_wiki.css" />
<link rel="STYLESHEET" type="text/css" href="/style/git_wiki.css" />
-<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/git_wiki.css" />
+<!--<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/git_wiki.css" />-->
{% endblock %}
{% block path %}
{{ block.super }}
<a href="/knowledge">knowledge</a>
-{% if item %}
- &raquo; <a href="/k/{{ item.slug }}/">{{ object.title }}</a>
-{% endif %}
{% endblock %}
{% block title %}
diff --git a/bn_django/git_wiki/templates/git_wiki/item.html b/bn_django/git_wiki/templates/git_wiki/item.html
index 0df1b72..7562fc6 100644
--- a/bn_django/git_wiki/templates/git_wiki/item.html
+++ b/bn_django/git_wiki/templates/git_wiki/item.html
@@ -1,11 +1,15 @@
{% extends "git_wiki/base.html" %}
+{% load markup %}
+
{% block path %}{{ block.super }} &raquo; <a href="/k/{{ item.slug }}/">
{{ item.path }}</a>{% endblock %}
{% block title %}Knowledge Item: {{ item.path }}{% endblock %}
{% block gitwiki %}
+ {{ item.contents|restructuredtext }}
+ <br /><hr />
<h3>Item name:</h3>
<span class="hash">{{ item.name }}</span>
<h3>Item sha1 hash:</h3>
diff --git a/bn_django/photos/templates/photos/base.html b/bn_django/photos/templates/photos/base.html
index 94d9808..d229057 100644
--- a/bn_django/photos/templates/photos/base.html
+++ b/bn_django/photos/templates/photos/base.html
@@ -1 +1,5 @@
{% extends "base.html" %}
+
+{% block path %}
+ <a href="/photos/">photos</a>
+{% endblock %}
diff --git a/bn_django/photos/templates/photos/gallery_detail.html b/bn_django/photos/templates/photos/gallery_detail.html
index f9d1bd6..318091b 100644
--- a/bn_django/photos/templates/photos/gallery_detail.html
+++ b/bn_django/photos/templates/photos/gallery_detail.html
@@ -2,8 +2,9 @@
{# {% load markup %} #}
{% block path %}
- <a href="../">photos</a> &raquo;
+{{ block.super }}
{% if object %}
+ &raquo;
<a href="../{{ object.id }}">{{ object.title }}</a>
{% endif %}
{% endblock %}
@@ -20,7 +21,6 @@ Gallery: {{ object.title }}
{% if object.photo_set.count %}
{% for item in object.photo_set.all %}
-
<span class="photo_thumb">
<a href="../detail/{{ item.id }}">
<img src="{{ item.thumburl }}"
diff --git a/bn_django/photos/templates/photos/gallery_list.html b/bn_django/photos/templates/photos/gallery_list.html
index 61225c4..b709092 100644
--- a/bn_django/photos/templates/photos/gallery_list.html
+++ b/bn_django/photos/templates/photos/gallery_list.html
@@ -1,7 +1,6 @@
{% extends "photos/base.html" %}
{# {% load markup %} #}
-{% block path %}photos{% endblock %}
{% block title %}Photo Galleries{% endblock %}
{% block content %}
diff --git a/bn_django/photos/templates/photos/photo_detail.html b/bn_django/photos/templates/photos/photo_detail.html
index d9c2177..10bf8ba 100644
--- a/bn_django/photos/templates/photos/photo_detail.html
+++ b/bn_django/photos/templates/photos/photo_detail.html
@@ -2,8 +2,11 @@
{# {% load markup %} #}
{% block path %}
- <a href="../..">photos</a> &raquo;
+ {{ block.super }}
+ &raquo;
<a href="../../{{ object.gallery.id }}">{{ object.gallery.title }}</a>
+ &raquo;
+ <a href="../{{ object.id }}">{{ object.title }}</a>
{% endblock %}
{% block title %}
diff --git a/bn_django/settings.py b/bn_django/settings.py
index 676a638..8041cc1 100644
--- a/bn_django/settings.py
+++ b/bn_django/settings.py
@@ -1,17 +1,17 @@
# Django settings for bn_django project.
-DEBUG = False
+DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@domain.com'),
- ('Bryan Newbold', 'bnewbold@bryannewbold.com'),
+ ('Bryan Newbold', 'bnewbold@mit.edu'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
-DATABASE_NAME = '/srv/django/bn_django.db' # Or path to database file if using sqlite3.
+DATABASE_NAME = '/home/bnewbold/bn-project/bn_django/bn_django.db' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
@@ -19,7 +19,7 @@ DATABASE_PORT = '' # Set to empty string for default. Not used with
# Local time zone for this installation. All choices can be found here:
# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
-TIME_ZONE = 'America/Seattle'
+TIME_ZONE = 'America/Boston'
# Language code for this installation. All choices can be found here:
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
@@ -34,16 +34,16 @@ USE_I18N = True
# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = '/srv/http/bryannewbold/static/'
+MEDIA_ROOT = '/home/bnewbold/bn-project/media/'
# URL that handles the media served from MEDIA_ROOT.
# Example: "http://media.lawrence.com"
-MEDIA_URL = 'http://static.bryannewbold.com/'
+MEDIA_URL = '/media/'
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = 'http://static.bryannewbold.com/django-admin/'
+ADMIN_MEDIA_PREFIX = '/style/django-admin/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'jdsgk29845ldsfg0090204tv(GFD8g0(%$)*@$#R%U)#*ifd;/q'
@@ -60,6 +60,7 @@ MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
+ 'django.contrib.csrf.middleware.CsrfMiddleware',
'django.middleware.doc.XViewMiddleware',
)
@@ -69,7 +70,7 @@ TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
- '/srv/django/bn-project/bn_django/templates',
+ '/home/bnewbold/bn-project/bn_django/templates',
)
INSTALLED_APPS = (
@@ -79,9 +80,11 @@ INSTALLED_APPS = (
'django.contrib.sites',
'django.contrib.admin',
'django.contrib.flatpages',
+ 'django.contrib.markup',
+ 'django.contrib.comments',
'bn_django.photos',
'bn_django.git_wiki',
'bn_django.git_browse',
)
-GITBROWSE_BASE = '/srv/git/'
+GITBROWSE_BASE = '/home/bnewbold/bn-project/code'
diff --git a/bn_django/templates/about.html b/bn_django/templates/about.html
index 86755d5..c9f9ce4 100644
--- a/bn_django/templates/about.html
+++ b/bn_django/templates/about.html
@@ -15,7 +15,7 @@
<br />
<div class="content_caption">the perp</div>
</div>
-This website is the web presence of <a href="k/BryanNewbold">Bryan Newbold</a>. It serves as a:
+This website is the web presence of <a href="/k/BryanNewbold">Bryan Newbold</a>. It serves as a:
<dl>
<dt /><a href="/knowledge">brain dump</a>
<dd /> so I won't forget
diff --git a/bn_django/templates/base.html b/bn_django/templates/base.html
index e574277..0df7a36 100644
--- a/bn_django/templates/base.html
+++ b/bn_django/templates/base.html
@@ -5,7 +5,7 @@
{% block stylesheets %}
<link rel="STYLESHEET" type="text/css" href="style/default.css" />
<link rel="STYLESHEET" type="text/css" href="/style/default.css" />
-<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/default.css" />
+<!--<link rel="STYLESHEET" type="text/css" href="http://static.bryannewbold.com/style/default.css" />-->
{% endblock %}
{% block externaljs %} {% endblock %}
<title>{% block windowtitle %}bryannewbold.com{% endblock %}</title>