changeset 6083:5e80523a1677

fix crash for too long page names, fix return type - should be unicode
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 14 Oct 2014 18:21:56 +0200
parents 2e2f7c6f39eb
children 14b0dff0d0c6
files MoinMoin/Page.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Wed Sep 17 08:17:15 2014 -0500
+++ b/MoinMoin/Page.py	Tue Oct 14 18:21:56 2014 +0200
@@ -212,14 +212,15 @@
                 f = codecs.open(self._text_filename(), 'rb', config.charset)
             except IOError, er:
                 import errno
-                if er.errno == errno.ENOENT:
-                    # just doesn't exist, return empty text (note that we
-                    # never store empty pages, so this is detectable and also
-                    # safe when passed to a function expecting a string)
-                    return ""
+                if er.errno in [errno.ENOENT, errno.ENAMETOOLONG, ]:
+                    # ENOENT: doesn't exist, file not found
+                    # ENAMETOOLONG: can't exist, name too long for this fs
+                    # return empty text (note that we never store empty pages,
+                    # so this is detectable and also safe when passed to a
+                    # function expecting a string)
+                    return u""
                 else:
                     raise
-
             # read file content and make sure it is closed properly
             try:
                 text = f.read()