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', '')
rel, href = link
print(' <link rel="%s" href="%s" />' % (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(' <link rel="alternate" type="application/x-wiki" title="Edit this page" href="%s" />' \
% (privileged_path() + '?a=edit&q=' + name))
print('</head>')
# Body
- if name and writable and privileged_url is not None:
+ if editable:
print('<body ondblclick="location.href=\'' + privileged_path() + '?a=edit&q=' + name + '\'">')
else:
print('<body>')
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:
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):
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:
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()