Don't choke on directories in full text search
authorBernardo Innocenti <bernie@codewiz.org>
Tue, 8 Jan 2008 22:09:55 +0000 (23:09 +0100)
committerBernardo Innocenti <bernie@codewiz.org>
Tue, 8 Jan 2008 22:09:55 +0000 (23:09 +0100)
geekigeeki.py

index a1c99a02742b3a862e2590af9b64addcd40fe6a3..db114337795e6d227f0673e2ffe86c6aab79edd8 100755 (executable)
@@ -593,6 +593,8 @@ class Page:
         except IOError, er:
             if er.errno == errno.ENOENT:
                 return '' # just doesn't exist, use default
+            if er.errno == errno.EISDIR:
+                return 'DIR'
             raise er
 
     def get_attrs(self):
@@ -690,12 +692,12 @@ class Page:
         send_footer(self.page_name)
 
     def send_raw(self, mimetype='text/plain'):
-        if not self.can_read():
+        if self.can_read():
+            body = self.get_raw_body()
+            emit_header(mimetype)
+            print body
+        else:
             send_title(None, msg='Read access denied by ACLs', msg_type='notice')
-            return
-        body = self.get_raw_body()
-        emit_header(mimetype)
-        print body
 
     def _write_file(self, text):
         tmp_filename = self._tmp_filename()