changeset 119:2390e9f1d1dc

fs19: improve user profile processing, user: use int bookmarks rename last_saved to MTIME (we also use MTIME as modification timestamp for wiki items). convert bookmark timestamps from str/usecs to int/secs kill 'show_fancy_links', not used any more remove 'email_subscribed_events' / 'jabber_subscribed_events', no support yet
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 13 Mar 2011 21:44:17 +0100
parents c9684bc241db
children 891c6d1551d4
files MoinMoin/storage/backends/fs19.py MoinMoin/user.py
diffstat 2 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/storage/backends/fs19.py	Sun Mar 13 20:27:17 2011 +0100
+++ b/MoinMoin/storage/backends/fs19.py	Sun Mar 13 21:44:17 2011 +0100
@@ -711,12 +711,16 @@
         for key, default in int_defaults:
             metadata[key] = int(metadata.get(key, default))
 
-        # int last_saved timestamp should be enough:
-        metadata['last_saved'] = int(float(metadata.get('last_saved', '0')))
+        # rename last_saved to MTIME, int MTIME should be enough:
+        metadata[MTIME] = int(float(metadata.get('last_saved', '0')))
 
         # rename subscribed_pages to subscribed_items
         metadata['subscribed_items'] = metadata['subscribed_pages']
 
+        # convert bookmarks from usecs (and str) to secs (int)
+        metadata['bookmarks'] = [(interwiki, int(long(bookmark)/1000000))
+                                 for interwiki, bookmark in metadata.get('bookmarks', {}).items()]
+
         # stuff we want to get rid of:
         kill = ['real_language', # crap (use 'language')
                 'wikiname_add_spaces', # crap magic (you get it like it is)
@@ -727,6 +731,7 @@
                 'passwd', # ancient, not used any more (use enc_passwd)
                 'show_emoticons', # ancient, not used any more
                 'show_fancy_diff', # kind of diff display now depends on mimetype
+                'show_fancy_links', # not used any more (now link rendering depends on theme)
                 'show_toolbar', # not used any more
                 'show_topbottom', # crap
                 'show_nonexist_qm', # crap, can be done by css
@@ -739,6 +744,9 @@
                 'tz_offset', # we have real timezone now
                 'date_fmt', # not used any more
                 'datetime_fmt', # not used any more
+                'last_saved', # renamed to MTIME
+                'email_subscribed_events', # XXX no support yet
+                'jabber_subscribed_events', # XXX no support yet
                ]
         for key in kill:
             if key in metadata:
--- a/MoinMoin/user.py	Sun Mar 13 20:27:17 2011 +0100
+++ b/MoinMoin/user.py	Sun Mar 13 21:44:17 2011 +0100
@@ -524,8 +524,7 @@
         """
         if self.valid:
             interwikiname = self._cfg.interwikiname or u''
-            bookmark = unicode(tm)
-            self.bookmarks[interwikiname] = bookmark
+            self.bookmarks[interwikiname] = int(tm)
             self.save()
 
     def getBookmark(self):
@@ -538,7 +537,7 @@
         interwikiname = self._cfg.interwikiname or u''
         if self.valid:
             try:
-                bm = int(self.bookmarks[interwikiname])
+                bm = self.bookmarks[interwikiname]
             except (ValueError, KeyError):
                 pass
         return bm