Just send GuruMeditation.js as an external file
authorBernie Innocenti <bernie@codewiz.org>
Wed, 8 Apr 2009 23:27:55 +0000 (01:27 +0200)
committerBernie Innocenti <bernie@codewiz.org>
Wed, 8 Apr 2009 23:27:55 +0000 (01:27 +0200)
geekigeeki.py

index 5bae68b43b78e972a0b1e987ee29a214130df87a..321beccac88b0cd15a72b7e61e3901cde0fb4ba8 100755 (executable)
@@ -87,13 +87,6 @@ def permalink(s):
 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 + '">'
@@ -103,10 +96,8 @@ def send_guru(msg_text, 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