def script_name():
return os.environ.get('SCRIPT_NAME', '')
+def script_path():
+ return os.path.split(os.environ.get('SCRIPT_FILENAME', ''))[0]
+
def query_string():
path_info = os.environ.get('PATH_INFO', '')
if len(path_info) and path_info[0] == '/':
cgi.print_form(form)
cgi.print_environ()
link_inline("sys/footer", kvargs = {
- 'LAST_MODIFIED': strftime(config_get(datetime_fmt, '%a %d %b %Y %I:%M %p'), localtime(mtime))
+ 'LAST_MODIFIED': strftime(config_get('datetime_fmt', '%a %d %b %Y %I:%M %p'), localtime(mtime))
})
print("</body></html>")
macro = globals().get('_macro_' + args[0])
return macro(*args, **kvargs)
except Exception, e:
- msg = cgi.escape(word) + ": " + cgi.escape(e.message)
+ msg = cgi.escape(word) + ": " + cgi.escape(str(e))
if not self.in_html:
msg = '<strong class="error">' + msg + '</strong>'
return msg
for filename in page_list(self._filename(), file_re):
if image_re.match(filename):
- maxwidth = config_get(image_maxwidth, '')
+ maxwidth = config_get('image_maxwidth', '400')
if maxwidth:
maxwidth = ' | maxwidth=' + str(maxwidth)
out += '{{' + self.page_name + '/' + filename + ' | ' + humanlink(filename) + maxwidth + ' | class=thumbleft}}\n'
except OSError, err:
if err.errno != errno.ENOENT: raise err
path = os.path.split(name)[0]
- if not os.path.exists(path):
+ if path and not os.path.exists(path):
os.makedirs(path)
os.rename(tmp_filename, name)