From: Bernie Innocenti Date: Wed, 19 Aug 2009 10:07:05 +0000 (+0200) Subject: Merge branch 'master' of ssh://trinity.codewiz.org/~/public_html/wiki/git/geekigeeki X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=2776ec9d104a0cd3fefb2ebb09bf32f4f13cc80a;p=geekigeeki.git Merge branch 'master' of ssh://trinity.codewiz.org/~/public_html/wiki/git/geekigeeki Conflicts: geekigeeki.py --- 2776ec9d104a0cd3fefb2ebb09bf32f4f13cc80a diff --cc geekigeeki.conf.py index d08db52,773f537..5c5d681 --- a/geekigeeki.conf.py +++ b/geekigeeki.conf.py @@@ -34,8 -31,14 +34,8 @@@ history_url = '../wikigit/wiki.git post_edit_hook = './post_edit_hook.sh' - datetime_fmt = '%a %d %b %Y %I:%M %p' + datetime_fmt = '%a, %d %b %Y %H:%M:%S %Z' -# Is it possible to edit pages? -allow_edit = True - -# show hostnames? -show_hosts = True - # prefix before nonexistent link (usually '?') nonexist_pfx = '' diff --cc geekigeeki.py index 07365fd,c5b5109..4569894 --- a/geekigeeki.py +++ b/geekigeeki.py @@@ -331,25 -328,28 +333,27 @@@ def make_index_key() links = ['%s' % (ch, ch) for ch in 'abcdefghijklmnopqrstuvwxyz'] return '

' + ' | '.join(links) + '

' -def page_list(dirname=None, re=None): - if re is None: +def page_list(dirname=None, search_re=None): + if search_re is None: # FIXME: WikiWord is too restrictive now! - re = re.compile(r"^\b((([A-Z][a-z0-9]+){2,}/)*([A-Z][a-z0-9]+){2,})\b$") - return sorted(filter(re.match, os.listdir(dirname or data_dir))) + search_re = re.compile(r"^\b((([A-Z][a-z0-9]+){2,}/)*([A-Z][a-z0-9]+){2,})\b$") + return sorted(filter(search_re.match, os.listdir(dirname or '.'))) - def send_footer(mod_string=None): + def send_footer(mtime=None): - if globals().get('debug_cgi', False): + if config_get('debug_cgi', False): cgi.print_arguments() cgi.print_form(form) cgi.print_environ() - link_inline("sys/footer", kvargs = { 'LAST_MODIFIED': mod_string }) - #FIXME link_inline("sys/footer") - print(''' -') ++ link_inline("sys/footer", kvargs = { ++ 'LAST_MODIFIED': strftime(config_get(datetime_fmt, '%a %d %b %Y %I:%M %p'), localtime(mtime)) ++ }) + print("") + +def _macro_ELAPSED_TIME(*args, **kvargs): + return "%03f" % (clock() - start_time) + +def _macro_VERSION(*args, **kvargs): + return __version__ class WikiFormatter: """Object that turns Wiki markup into HTML. @@@ -627,20 -624,24 +631,24 @@@ class Page return re.sub('([a-z])([A-Z])', r'\1 \2', self.page_name) def _filename(self): - return os.path.join(data_dir, self.page_name) + return self.page_name def _tmp_filename(self): - return os.path.join(data_dir, ('#' + self.page_name.replace('/','_') + '.' + str(os.getpid()) + '#')) + return self.page_name + '.tmp' + str(os.getpid()) + '#' - def exists(self): + def _mtime(self): try: - os.stat(self._filename()) - return True + return os.stat(self._filename()).st_mtime except OSError, err: if err.errno == errno.ENOENT: - return False + return None raise err + def exists(self): + if self._mtime(): + return True + return False + def get_raw_body(self, default=None): try: return open(self._filename(), 'rb').read()