def emit_header(mime_type="text/html"):
print "Content-type: " + mime_type + "; charset=utf-8\n"
-def sendfile(dest_file, src_file):
- """Efficiently copy file data between file descriptors"""
- while 1:
- data = src_file.read(65536)
- if not data: break
- dest_file.write(data)
-
def send_guru(msg_text, msg_type):
if not msg_text: return
print '<pre id="guru" onclick="this.style.display = \'none\'" class="' + msg_type + '">'
if msg_type == 'error':
print '\n Guru Meditation #DEADBEEF.ABADC0DE'
print '</pre>'
- try:
- sendfile(sys.stdout, open('gurumeditation.js', 'rb'))
- except IOError, err:
- pass
+ print '<script language="JavaScript" type="text/javascript" src="%s" defer="defer"></script>' \
+ % relative_url('GuruMeditation.js')
def send_title(name, text="Limbo", msg_text=None, msg_type='error', writable=False):
global title_done