changeset 2044:967d529b31e9

workaround for initially non-existing edit-log, remove edit-log from repo
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 02 Jun 2007 16:35:58 +0200
parents cc636ac8d6a6
children b3ddb4504ec6 1e18f9e4f228
files MoinMoin/logfile/__init__.py wiki/data/edit-log
diffstat 2 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/logfile/__init__.py	Tue May 15 19:11:39 2007 +0200
+++ b/MoinMoin/logfile/__init__.py	Sat Jun 02 16:35:58 2007 +0200
@@ -143,8 +143,18 @@
                 # Open the file (NOT using codecs.open, it breaks our offset calculation. We decode it later.).
                 # Use binary mode in order to retain \r - otherwise the offset calculation would fail.
                 self._input = file(self.__filename, "rb",)
-            except IOError:
-                raise StopIteration
+            except IOError, err:
+                if err.errno == 2: # POSIX errno.ENOENT "file not found"
+                    try:
+                        # XXX workaround if edit-log does not exist: just create it empty
+                        f = file(self.__filename, "ab")
+                        f.write('')
+                        f.close()
+                        self._input = file(self.__filename, "rb",)
+                        return self._input
+                    except:
+                        pass
+                    raise StopIteration
             return self._input
         elif name == "_output":
             self._output = codecs.open(self.__filename, 'a', config.charset)
--- a/wiki/data/edit-log	Tue May 15 19:11:39 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-1172193184000000	00000002	SAVE	WikiSandBox	127.0.0.1	localhost