2 # -*- coding: utf-8 -*-
4 # Copyright 1999, 2000 Martin Pool <mbp@humbug.org.au>
5 # Copyright 2002 Gerardo Poggiali
6 # Copyright 2007, 2008, 2009 Bernie Innocenti <bernie@codewiz.org>
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 __version__ = '$Id$'[4:12]
23 from time import clock
26 import cgi, sys, os, re, errno, stat
28 # Regular expression defining a WikiWord
29 # (but this definition is also assumed in other places)
30 word_re = re.compile(r"^\b((([A-Z][a-z0-9]+){2,}/)*([A-Z][a-z0-9]+){2,})\b$")
31 # FIXME: we accept stuff like foo/../bar and we shouldn't
32 file_re = re.compile(r"^\b([A-Za-z0-9_\-][A-Za-z0-9_\.\-/]*)\b$")
33 img_re = re.compile(r"^.*\.(png|gif|jpg|jpeg|bmp|ico|ogm|ogg|mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt)$", re.IGNORECASE)
34 video_re = re.compile(r"^.*\.(ogm|ogg|mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt)$", re.IGNORECASE)
35 url_re = re.compile(r"^[a-z]{3,8}://[^\s'\"]+\S$")
36 link_re = re.compile(r"(?:\[\[|{{)([^\s\|]+)(?:\s*\|\s*([^\]]+)|)(?:\]\]|}})")
37 ext_re = re.compile(r"\.([^\./]+)$")
41 # CGI stuff ---------------------------------------------------------
43 return os.environ.get('SCRIPT_NAME', '')
46 path_info = os.environ.get('PATH_INFO', '')
47 if len(path_info) and path_info[0] == '/':
48 return path_info[1:] or 'FrontPage'
50 return os.environ.get('QUERY_STRING', '') or 'FrontPage'
52 def privileged_path():
53 return privileged_url or script_name()
56 user = os.environ.get('REMOTE_USER', '')
57 if user is None or user == '' or user == 'anonymous':
58 user = 'AnonymousCoward'
62 return os.environ.get('REMOTE_ADDR', '')
64 def get_hostname(addr):
66 from socket import gethostbyaddr
67 return gethostbyaddr(addr)[0] + ' (' + addr + ')'
71 def is_external_url(pathname):
72 return (url_re.match(pathname) or pathname.startswith('/'))
74 def relative_url(pathname, privileged=False):
75 if not is_external_url(pathname):
77 url = privileged_path()
80 pathname = url + '/' + pathname
81 return cgi.escape(pathname, quote=True)
84 return re.sub(' ', '-', re.sub('[^a-z0-9_ ]', '', s.lower()).strip())
86 # Formatting stuff --------------------------------------------------
87 def emit_header(mime_type="text/html"):
88 print("Content-type: " + mime_type + "; charset=utf-8\n")
90 def send_guru(msg_text, msg_type):
91 if not msg_text: return
92 print('<pre id="guru" onclick="this.style.display = \'none\'" class="' + msg_type + '">')
93 if msg_type == 'error':
94 print(' Software Failure. Press left mouse button to continue.\n')
96 if msg_type == 'error':
97 print '\n Guru Meditation #DEADBEEF.ABADC0DE'
98 print('</pre><script language="JavaScript" type="text/javascript" src="%s" defer="defer"></script>' \
99 % relative_url('sys/GuruMeditation.js'))
101 def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=False):
103 if title_done: return
107 print('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"')
108 print(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">')
109 print('<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">')
111 print("<head><title>%s: %s</title>" % (site_name, text))
112 print(' <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />')
114 print(' <meta name="robots" content="noindex,nofollow" />')
116 for meta in meta_urls:
117 http_equiv, content = meta
118 print(' <meta http-equiv="%s" content="%s" />' % (http_equiv, relative_url(content)))
120 for link in link_urls:
122 print(' <link rel="%s" href="%s" />' % (rel, relative_url(href)))
124 if name and writable and privileged_url is not None:
125 print(' <link rel="alternate" type="application/x-wiki" title="Edit this page" href="%s" />' \
126 % (privileged_path() + '?edit=' + name))
128 if history_url is not None:
129 print(' <link rel="alternate" type="application/rss+xml" title="RSS" href="%s" />' \
130 % relative_url(history_url + '?a=rss'))
135 if name and writable and privileged_url is not None:
136 print('<body ondblclick="location.href=\'' + privileged_path() + '?edit=' + name + '\'">')
141 send_guru(msg_text, msg_type)
144 print('<div class="nav">')
145 print link_tag('FrontPage', site_icon or 'Home', 'navlink')
147 print(' <b>' + link_tag('?fullsearch=' + name, text, 'navlink') + '</b> ')
149 print(' <b>' + text + '</b> ')
150 print(' | ' + link_tag('FindPage', 'Find Page', 'navlink'))
151 if 'history_url' in globals():
152 print(' | <a href="' + relative_url(history_url) + '" class="navlink">Recent Changes</a>')
154 print(' | <a href="' + relative_url(history_url + '?a=history;f=' + name) + '" class="navlink">Page History</a>')
157 print(' | ' + link_tag('?raw=' + name, 'Raw Text', 'navlink'))
158 if privileged_url is not None:
160 print(' | ' + link_tag('?edit=' + name, 'Edit', 'navlink', privileged=True))
162 print(' | ' + link_tag(name, 'Login', 'navlink', privileged=True))
165 print(' | <i>Immutable Page</i>')
168 if user != 'AnonymousCoward':
169 print(' | <span class="login"><i><b>' + link_tag('User/' + user, user) + '</b></i></span>')
171 print('<hr /></div>')
173 def send_httperror(status="403 Not Found", query=""):
174 print("Status: %s" % status)
175 send_title(None, msg_text=("%s: on query '%s'" % (status, query)))
178 def link_tag(params, text=None, link_class=None, privileged=False):
180 text = params # default
181 elif img_re.match(text):
182 text = '<img border="0" src="' + relative_url(text) + '" alt="' + text + '" />'
185 if is_external_url(params):
186 link_class = 'external'
187 elif file_re.match(params) and Page(params).exists():
188 link_class = 'wikilink'
190 params = nonexist_pfx + params
191 link_class = 'nonexistent'
193 classattr = 'class="%s" ' % link_class
194 # Prevent crawlers from following links potentially added by spammers or to generated pages
195 if link_class == 'external' or link_class == 'navlink':
196 classattr += 'rel="nofollow"'
198 return '<a %shref="%s">%s</a>' % (classattr, relative_url(params, privileged=privileged), text)
200 def link_inline(name, descr=None, args=''):
201 if not descr: descr = name
202 url = relative_url(name)
203 if video_re.match(name):
204 return '<video src="%s">Your browser does not support the HTML5 video tag</video>' % url
205 elif img_re.match(name):
206 return '<a href="%s"><img border="0" src="%s" alt="%s" /></a>' % (url, url + args, descr)
207 elif file_re.match(name) and not ext_re.search(name): # FIXME: this guesses a wiki page
208 return Page(name).send_naked()
210 return '<iframe width="100%%" scrolling="auto" frameborder="0" src="%s"><a href="%s">%s</a></iframe>' \
213 # Search ---------------------------------------------------
215 def handle_fullsearch(needle):
216 send_title(None, 'Full text search for "%s"' % (needle))
218 needle_re = re.compile(needle, re.IGNORECASE)
220 all_pages = page_list()
221 for page_name in all_pages:
222 body = Page(page_name).get_raw_body()
223 count = len(needle_re.findall(body))
225 hits.append((count, page_name))
227 # The default comparison for tuples compares elements in order,
228 # so this sorts by number of hits
233 for (count, page_name) in hits:
234 print('<li><p>' + link_tag(page_name))
235 print(' . . . . ' + `count`)
236 print(['match', 'matches'][count != 1])
240 print_search_stats(len(hits), len(all_pages))
242 def handle_titlesearch(needle):
243 # TODO: check needle is legal -- but probably we can just accept any RE
244 send_title(None, "Title search for \"" + needle + '"')
246 needle_re = re.compile(needle, re.IGNORECASE)
247 all_pages = page_list()
248 hits = list(filter(needle_re.search, all_pages))
251 for filename in hits:
252 print('<li><p>' + link_tag(filename) + "</p></li>")
255 print_search_stats(len(hits), len(all_pages))
257 def print_search_stats(hits, searched):
258 print("<p>%d hits out of %d pages searched.</p>" % (hits, searched))
260 def handle_raw(pagename):
261 if not file_re.match(pagename):
262 send_httperror("403 Forbidden", pagename)
265 Page(pagename).send_raw()
267 def handle_edit(pagename):
268 if not file_re.match(pagename):
269 send_httperror("403 Forbidden", pagename)
274 if form['file'].value:
275 pg.save(form['file'].file.read(), form['changelog'].value)
277 pg.save(form['savetext'].value.replace('\r\n', '\n'), form['changelog'].value)
279 elif 'cancel' in form:
280 pg.msg_text = 'Editing canceled'
281 pg.msg_type = 'notice'
283 else: # preview or edit
285 if 'preview' in form:
286 text = form['savetext'].value
289 # Used by macros/WordIndex and macros/TitleIndex
290 def make_index_key():
291 links = ['<a href="#%s">%s</a>' % (ch, ch) for ch in 'abcdefghijklmnopqrstuvwxyz']
292 return '<p style="text-align: center">' + ' | '.join(links) + '</p>'
294 def page_list(dirname = None, re = word_re):
295 return sorted(filter(re.match, os.listdir(dirname or data_dir)))
297 def send_footer(mod_string=None):
298 if globals().get('debug_cgi', False):
299 cgi.print_arguments()
303 <div id="footer"><hr />
304 <p class="copyright">
305 <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img class="license" alt="Creative Commons License" src="%s" /></a>
306 <span class="benchmark">generated in %0.3fs</span> by <a href="http://www.codewiz.org/wiki/GeekiGeeki">GeekiGeeki</a> version %s
308 ''' % (relative_url('cc-by-sa.png'), clock() - start_time, __version__))
310 print('<p class="modified">last modified %s</p>' % mod_string)
311 print('</div></body></html>')
314 """Object that turns Wiki markup into HTML.
316 All formatting commands can be parsed one line at a time, though
317 some state is carried over between lines.
319 def __init__(self, raw):
322 self.in_pre = self.in_html = self.in_table = self.in_li = False
323 self.in_header = True
324 self.list_indents = []
332 "^^": ["sup", False],
333 ",,": ["sub", False],
334 "''": ["em", False], # LEGACY
335 "'''": ["b", False], # LEGACY
336 "``": ["tt", False], # LEGACY
339 def _b_repl(self, word):
340 style = self.styles[word]
341 style[1] = not style[1]
342 return ['</', '<'][style[1]] + style[0] + '>'
344 def _tit_repl(self, word):
346 result = '</h%d><p>\n' % self.h_level
349 self.h_level = len(word) - 1
350 link = permalink(self.line)
351 result = '\n</p><h%d id="%s"><a class="heading" href="#%s">¶</a> ' % (self.h_level, link, link)
354 def _br_repl(self, word):
357 def _rule_repl(self, word):
358 return self._undent() + '\n<hr size="%d" noshade="noshade" />\n' % (len(word) - 2)
360 def _macro_repl(self, word):
361 m = re.compile("\<\<([^\s\|\>]+)(?:\s*\|\s*([^\>]+)|)\>\>").match(word)
365 argv.extend(m.group(2).split('|'))
366 argv = list(map(str.strip, argv))
368 macro = globals().get('_macro_' + name)
371 exec(open("macros/" + name + ".py").read(), globals())
372 except IOError as err:
373 if err.errno == errno.ENOENT: pass
374 macro = globals().get('_macro_' + name)
378 msg = '<<' + '|'.join(argv) + '>>'
380 msg = '<strong class="error">' + msg + '</strong>'
383 def _hurl_repl(self, word):
384 m = link_re.match(word)
385 return link_tag(m.group(1), m.group(2))
387 def _inl_repl(self, word):
388 (name, descr) = link_re.match(word).groups()
391 argv = descr.split('|')
395 args = '?' + '&'.join(argv)
397 # The "extthumb" nonsense works around a limitation of the HTML block model
398 return '<div class="extthumb"><div class="thumb">' \
399 + link_inline(name, descr, args) \
400 + '<div class="caption">' + descr + '</div></div></div>'
402 return link_inline(name, name)
404 def _html_repl(self, word):
405 if not self.in_html and word.startswith('<div'): word = '</p>' + word
407 return word; # Pass through
409 def _htmle_repl(self, word):
411 if not self.in_html and word.startswith('</div'): word += '<p>'
412 return word; # Pass through
414 def _ent_repl(self, s):
416 return s; # Pass through
417 return {'&': '&',
421 def _img_repl(self, word): # LEGACY
422 return self._inl_repl('{{' + word + '}}')
424 def _word_repl(self, word): # LEGACY
425 if self.in_html: return word # pass through
426 return link_tag(word)
428 def _url_repl(self, word): # LEGACY
429 if self.in_html: return word # pass through
430 return link_tag(word)
432 def _email_repl(self, word): # LEGACY
433 if self.in_html: return word # pass through
434 return '<a href="mailto:%s">%s</a>' % (word, word)
436 def _li_repl(self, match):
443 def _pre_repl(self, word):
444 if word == '{{{' and not self.in_pre:
452 def _hi_repl(self, word):
453 return '<strong class="highlight ' + word + '">' + word + '</strong>'
455 def _tr_repl(self, word):
457 if not self.in_table:
460 out = '</p><table><tbody>\n'
462 out = out + '<tr class="' + ['even', 'odd'][self.tr_cnt % 2] + '">'
463 return out + ['<td>', '<th>'][word.strip() == '||=']
465 def _td_repl(self, word):
467 return ['</td><td>', '</th><th>'][word.strip() == '||=']
470 def _tre_repl(self, word):
472 return ['</td></tr>', '</th></tr>'][word.strip() == '||=']
475 def _indent_level(self):
476 return len(self.list_indents) and self.list_indents[-1]
478 def _indent_to(self, new_level):
479 if self._indent_level() == new_level:
482 while self._indent_level() > new_level:
483 del(self.list_indents[-1])
486 self.in_li = False # FIXME
488 while self._indent_level() < new_level:
489 self.list_indents.append(new_level)
496 res += '</ul>' * len(self.list_indents)
498 self.list_indents = []
501 def replace(self, match):
502 for rule, hit in list(match.groupdict().items()):
504 return getattr(self, '_' + rule + '_repl')(hit)
506 raise "Can't handle match " + repr(match)
508 def print_html(self):
509 print('<div class="wiki"><p>')
511 scan_re = re.compile(r"""(?:
512 # Styles and formatting
513 (?P<b> \*\*|'''|//|''|\#\#|``|__|\^\^|,,)
517 | (?P<hi> \b( FIXME | TODO | DONE )\b )
520 | (?P<macro> \<\<([^\s\|\>]+)(?:\s*\|\s*([^\>]+)|)\>\>)
521 | (?P<hurl> \[\[([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\]\])
524 | (?P<html> <(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])\b )
525 | (?P<htmle> ( /\s*> | </(br|hr|div|span|form|iframe|input|textarea|a|img|h[1-5])> ) )
528 # Auto links (LEGACY)
529 | (?P<img> \b[a-zA-Z0-9_/-]+\.(png|gif|jpg|jpeg|bmp|ico|ogm|ogg|mkv|mpg|mpeg|mp4|avi|asf|flv|wmv|qt))
530 | (?P<word> \b(?:[A-Z][a-z]+){2,}\b)
531 | (?P<url> (http|https|ftp|mailto)\:[^\s'\"]+\S)
532 | (?P<email> [-\w._+]+\@[\w.-]+)
535 | (?P<li> ^\s+[\*\#]\s+)
536 | (?P<pre> \{\{\{|\s*\}\}\})
537 | (?P<inl> \{\{([^\s\|]+)(?:\s*\|\s*([^\]]+)|)\}\})
540 | (?P<tr> ^\s*\|\|(=|)\s*)
541 | (?P<tre> \s*\|\|(=|)\s*$)
542 | (?P<td> \s*\|\|(=|)\s*)
544 # TODO: highlight search words (look at referrer)
546 pre_re = re.compile("""(?:
550 blank_re = re.compile(r"^\s*$")
551 indent_re = re.compile(r"^\s*")
552 tr_re = re.compile(r"^\s*\|\|")
553 eol_re = re.compile(r"\r?\n")
554 # For each line, we scan through looking for magic strings, outputting verbatim any intervening text
555 for self.line in eol_re.split(str(self.raw.expandtabs(), 'utf-8')):
558 if self.line.startswith('#'):
560 self.in_header = False
563 print(re.sub(pre_re, self.replace, self.line))
565 if self.in_table and not tr_re.match(self.line):
566 self.in_table = False
567 print('</tbody></table><p>')
569 if blank_re.match(self.line):
572 indent = indent_re.match(self.line)
573 print(self._indent_to(len(indent.group(0))), end=' ')
574 print(re.sub(scan_re, self.replace, self.line))
576 if self.in_pre: print('</pre>')
577 if self.in_table: print('</tbody></table><p>')
578 print(self._undent())
582 def __init__(self, page_name):
583 self.page_name = page_name
585 self.msg_type = 'error'
587 def split_title(self):
588 # look for the end of words and the start of a new word and insert a space there
589 return re.sub('([a-z])([A-Z])', r'\1 \2', self.page_name)
592 return os.path.join(data_dir, self.page_name)
594 def _tmp_filename(self):
595 return os.path.join(data_dir, ('#' + self.page_name.replace('/','_') + '.' + str(os.getpid()) + '#'))
599 os.stat(self._filename())
601 except OSError as err:
602 if err.errno == errno.ENOENT:
606 def get_raw_body(self, default=None):
608 return open(self._filename(), 'rb').read()
609 except IOError as err:
610 if err.errno == errno.ENOENT:
612 default = '//[[?edit=%s|Describe %s]]//' % (self.page_name, self.page_name)
614 if err.errno == errno.EISDIR:
615 return self.format_dir()
618 def format_dir(self):
621 for dirname in self.page_name.split('/'):
622 pathname = (pathname + '/' + dirname) if pathname else dirname
623 out += '[[' + pathname + '|' + dirname + ']]/'
626 for filename in page_list(self._filename(), file_re):
627 if img_re.match(filename):
629 maxwidth_arg = '|maxwidth=' + str(image_maxwidth)
630 out += '{{' + self.page_name + '/' + filename + '|' + filename + maxwidth_arg + '}}\n'
632 out += ' * [[' + self.page_name + '/' + filename + ']]\n'
636 if not '_pragmas' in self.__dict__:
639 file = open(self._filename(), 'rt')
640 attr_re = re.compile(r"^#(\S*)(.*)$")
642 m = attr_re.match(line)
645 self._pragmas[m.group(1)] = m.group(2).strip()
646 #print "bernie: pragmas[" + m.group(1) + "] = " + m.group(2) + "<br>\n"
647 except IOError as err:
648 if err.errno != errno.ENOENT and err.errno != errno.EISDIR:
652 def pragma(self, name, default):
653 return self.pragmas().get(name, default)
655 def can(self, action, default=True):
658 #acl SomeUser:read,write All:read
659 acl = self.pragma("acl", None)
660 for rule in acl.split():
661 (user, perms) = rule.split(':')
662 if user == remote_user() or user == "All":
663 return action in perms.split(',')
667 self.msg_text = 'Illegal acl line: ' + acl
671 return self.can("write", True)
674 return self.can("read", True)
676 def send_naked(self):
678 WikiFormatter(self.get_raw_body()).print_html()
680 send_guru("Read access denied by ACLs", "notice")
684 value = self.pragma("css", None)
687 link_urls += [ [ "stylesheet", value ] ]
689 send_title(self.page_name, self.split_title(),
690 msg_text=self.msg_text, msg_type=self.msg_type, writable=self.can_write())
692 send_footer(self._last_modified())
694 def _last_modified(self):
696 from time import localtime, strftime
697 modtime = localtime(os.stat(self._filename())[stat.ST_MTIME])
698 except OSError as err:
699 if err.errno != errno.ENOENT:
702 return strftime(datetime_fmt, modtime)
704 def send_editor(self, preview=None):
705 send_title(None, 'Edit ' + self.split_title(), msg_text=self.msg_text, msg_type=self.msg_type)
706 if not self.can_write():
707 send_guru("Write access denied by ACLs", "error")
712 filename = form['file'].value
714 print(('<p><b>Editing ' + self.page_name
715 + ' for ' + cgi.escape(remote_user())
716 + ' from ' + cgi.escape(get_hostname(remote_host()))
718 print('<div class="editor"><form name="editform" method="post" enctype="multipart/form-data" action="%s">' % relative_url(self.page_name))
719 print('<input type="hidden" name="edit" value="%s">' % (self.page_name))
720 print('<input type="input" id="editor" name="changelog" value="Edit page %s" accesskey="c" /><br />' % (self.page_name))
721 print('<textarea wrap="off" spellcheck="true" id="editor" name="savetext" rows="17" cols="100" accesskey="e">%s</textarea>' \
722 % cgi.escape(preview or self.get_raw_body(default='')))
723 print('<label for="file" accesskey="u">Or Upload a file:</label> <input type="file" name="file" value="%s" />' % filename)
726 <input type="submit" name="save" value="Save" accesskey="s">
727 <input type="submit" name="preview" value="Preview" accesskey="p" />
728 <input type="reset" value="Reset" />
729 <input type="submit" name="cancel" value="Cancel" />
732 <script language="javascript">
734 document.editform.savetext.focus()
738 print("<p>" + link_tag('EditingTips') + "</p>")
740 print("<div class='preview'>")
741 WikiFormatter(preview).print_html()
745 def send_raw(self, mimetype='text/plain', args=[]):
746 if not self.can_read():
747 send_title(None, msg_text='Read access denied by ACLs', msg_type='notice')
750 if 'maxwidth' in args:
752 emit_header(mimetype)
754 subprocess.check_call(['gm', 'convert', self._filename(),
755 '-scale', args['maxwidth'].value + ' >', '-'])
757 body = self.get_raw_body()
758 emit_header(mimetype)
761 def _write_file(self, data):
762 tmp_filename = self._tmp_filename()
763 open(tmp_filename, 'wb').write(data)
764 name = self._filename()
766 # Bad Bill! POSIX rename ought to replace. :-(
769 except OSError as err:
770 if err.errno != errno.ENOENT: raise err
771 os.rename(tmp_filename, name)
773 def save(self, newdata, changelog):
774 if not self.can_write():
775 self.msg_text = 'Write access denied by ACLs'
776 self.msg_type = 'error'
779 self._write_file(newdata)
783 cmd = [ post_edit_hook, data_dir + '/' + self.page_name, remote_user(), remote_host(), changelog]
784 child = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
785 output = child.stdout.read()
788 self.msg_text += "Post-editing hook returned %d. Command was:\n'%s'\n" % (rc, "' '".join(cmd))
790 self.msg_text += 'Output follows:\n' + output
792 self.msg_text = 'Thank you for your contribution. Your attention to detail is appreciated.'
793 self.msg_type = 'success'
797 handler = globals().get('handle_' + cmd)
799 handler(form[cmd].value)
802 query = query_string()
803 if file_re.match(query):
804 # FIMXE: this is all bullshit, MimeTypes bases its guess on the extension!
805 from mimetypes import MimeTypes
806 mimetype, encoding = MimeTypes().guess_type(query)
808 Page(query).send_raw(mimetype=mimetype, args=form)
812 send_httperror("403 Forbidden", query)
815 exec(open("geekigeeki.conf.py").read())
816 form = cgi.FieldStorage()
820 msg_text = traceback.format_exc()
822 send_guru(msg_text, "error")
824 send_title(None, msg_text=msg_text)