changeset 6003:575660fc7a5a

fix "moin import wikipage" timestamp confusion
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 24 Nov 2013 02:27:09 +0100
parents 072577e05c0c
children 2061aa0dff6d
files MoinMoin/PageEditor.py MoinMoin/script/import/wikipage.py docs/CHANGES
diffstat 3 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Tue Nov 19 09:25:50 2013 -0800
+++ b/MoinMoin/PageEditor.py	Sun Nov 24 02:27:09 2013 +0100
@@ -916,6 +916,11 @@
         _ = self._
         was_deprecated = self.pi.get('deprecated', False)
 
+        if self.mtime is None:
+            mtime_usecs = None
+        else:
+            mtime_usecs = wikiutil.timestamp2version(self.mtime)
+
         self.copy_underlay_page()
 
         # remember conflict state
@@ -999,8 +1004,6 @@
             else:
                 filesys.rename(cltfn, clfn)
 
-            if self.mtime is not None:
-                mtime_usecs = self.mtime
             if not deleted:
                 # save to page file
                 pagefile = os.path.join(revdir, revstr)
@@ -1008,16 +1011,16 @@
                 # Write the file using text/* mime type
                 f.write(self.encodeTextMimeType(text))
                 f.close()
-                if self.mtime is None:
-                    mtime_usecs = os.path.getmtime(pagefile)
+                if mtime_usecs is None:
+                    mtime_usecs = wikiutil.timestamp2version(os.path.getmtime(pagefile))
                 # set in-memory content
                 self.set_raw_body(text)
             else:
-                if self.mtime is None:
-                    mtime_usecs = time.time()
+                if mtime_usecs is None:
+                    mtime_usecs = wikiutil.timestamp2version(time.time())
                 # set in-memory content
                 self.set_raw_body(None)
-            mtime_usecs = wikiutil.timestamp2version(mtime_usecs)
+
             # reset page object
             self.reset()
 
--- a/MoinMoin/script/import/wikipage.py	Tue Nov 19 09:25:50 2013 -0800
+++ b/MoinMoin/script/import/wikipage.py	Sun Nov 24 02:27:09 2013 +0100
@@ -12,7 +12,7 @@
 
 from MoinMoin.PageEditor import PageEditor
 from MoinMoin.script import MoinScript, fatal, log
-from MoinMoin.wikiutil import clean_input, decodeUnknownInput, timestamp2version
+from MoinMoin.wikiutil import clean_input, decodeUnknownInput
 
 
 class IAmRoot(object):
@@ -77,9 +77,9 @@
         comment = clean_input(self.options.comment)
 
         if self.options.mtime:
-            mtime = timestamp2version(calendar.timegm(time.strptime(self.options.mtime, "%Y-%m-%d %H:%M:%S")))
+            mtime = calendar.timegm(time.strptime(self.options.mtime, "%Y-%m-%d %H:%M:%S"))
         else:
-            mtime = timestamp2version(time.time())
+            mtime = time.time()
 
 
         pe = PageEditor(request, self.options.page, do_editor_backup=0,
--- a/docs/CHANGES	Tue Nov 19 09:25:50 2013 -0800
+++ b/docs/CHANGES	Sun Nov 24 02:27:09 2013 +0100
@@ -74,6 +74,7 @@
   * fixed wrong detection of UI language from accept-language header for not
     logged-in users if the language identifier there was (partially) uppercase.
   * fix Python 2.7.4/5 compatibility issue with rss_rc action using handler._out
+  * fix "moin import wikipage" timestamp confusion
 
   Other changes:
   * rss_rc action (RSS feed) is now much faster / much less resource consuming