From 9e620650b196410c0e827ae5000863af2813160d Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Mon, 17 Aug 2009 19:38:08 +0200 Subject: [PATCH] use config_get() for privileged_url too --- geekigeeki.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/geekigeeki.py b/geekigeeki.py index 73c45ce..f5c9f96 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -50,7 +50,7 @@ def query_string(): return os.environ.get('QUERY_STRING', '') or 'FrontPage' def privileged_path(): - return privileged_url or script_name() + return config_get('privileged_url') or script_name() def remote_user(): user = os.environ.get('REMOTE_USER', '') @@ -144,7 +144,8 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal rel, href = link print(' ' % (rel, relative_url(href))) - if name and writable and privileged_url is not None: + editable = name and writable and config_get('privileged_url') is not None + if editable: print(' ' \ % (privileged_path() + '?a=edit&q=' + name)) @@ -156,7 +157,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal print('') # Body - if name and writable and privileged_url is not None: + if editable: print('') else: print('') @@ -179,7 +180,7 @@ def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=Fal if name: print(' | ' + link_tag(name + '?a=raw', 'Raw Text', cssclass='navlink')) - if privileged_url is not None: + if config_get('privileged_url') is not None: if writable: print(' | ' + link_tag('?a=edit&q=' + name, 'Edit', cssclass='navlink', privileged=True)) else: @@ -333,7 +334,7 @@ def page_list(dirname=None, re=None): if 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 config_get(data_dir, '')))) + return sorted(filter(re.match, os.listdir(dirname or config_get('data_dir', 'data')))) def send_footer(mod_string=None): if config_get('debug_cgi', False): @@ -625,10 +626,10 @@ class Page: return re.sub('([a-z])([A-Z])', r'\1 \2', self.page_name) def _filename(self): - return os.path.join(config_get('data_dir', ''), self.page_name) + return os.path.join(config_get('data_dir', 'data'), self.page_name) def _tmp_filename(self): - return os.path.join(config_get('data_dir', ''), ('#' + self.page_name.replace('/','_') + '.' + str(os.getpid()) + '#')) + return os.path.join(config_get('data_dir', 'data'), ('#' + self.page_name.replace('/','_') + '.' + str(os.getpid()) + '#')) def exists(self): try: @@ -821,8 +822,8 @@ class Page: if config_get('post_edit_hook'): import subprocess cmd = [ - config_get(post_edit_hook), - config_get(data_dir, '') + '/' + self.page_name, remote_user(), + config_get('post_edit_hook'), + os.path.join(config_get('data_dir', 'data'), self.page_name), remote_user(), remote_host(), changelog ] child = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True) output = child.stdout.read() -- 2.25.1