privileged_url = 'https://www.codewiz.org/~bernie/wiki'
data_dir = '/home/bernie/public_html/wiki/data'
-css_url = '../wikidata/geekigeeki.css' # optional stylesheet link
+css_url = ['../wikidata/geekigeeki.css'] # optional stylesheet links
history_url = '../wikigit/wiki.git'
post_edit_hook = './post_edit_hook.sh'
-#! /usr/bin/env python
+#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 1999, 2000 Martin Pool <mbp@humbug.org.au>
print ' <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />'
if not name:
print ' <meta name="robots" content="noindex,nofollow" />'
- if globals().has_key('css_url'):
- print ' <link rel="stylesheet" type="text/css" href="%s" />' % css_url
+ for css in css_url:
+ print ' <link rel="stylesheet" type="text/css" href="%s" />' % css
print '</head>'
# Body
self.page_name = page_name
self.msg = ''
self.msg_type = 'error'
- self.attrs = {}
def split_title(self):
# look for the end of words and the start of a new word,
raise er
def get_attrs(self):
- if self.attrs:
+ if self.__dict__.has_key('attrs'):
return self.attrs
+ self.attrs = {}
try:
file = open(self._text_filename(), 'rt')
attr_re = re.compile(r"^#(\S*)(.*)$")
raise er
return self.attrs
+ def get_attr(self, name, default):
+ if self.get_attrs().has_key(name):
+ return self.get_attrs()[name]
+ else:
+ return default
+
def can(self, action, default=True):
- attrs = self.get_attrs()
try:
- # SomeUser:read,write All:read
- acl = attrs["acl"]
+ #acl SomeUser:read,write All:read
+ acl = self.get_attr("acl", None)
for rule in acl.split():
(user,perms) = rule.split(':')
if user == remote_user() or user == "All":
page_name = None
if self.can_write():
page_name = self.page_name
+
+ #FIXME: are there security implications?
+ #css foo.css bar.css
+ global css_url
+ css_url = css_url + self.get_attr("css", "").split()
+
send_title(page_name, self.split_title(), msg=self.msg, msg_type=self.msg_type)
if self.can_read():
PageFormatter(self.get_raw_body()).print_html()