changeset 1923:eefebea247a0

user profiles: store lists with key[]=val1\tval2... (thanks to Johannes Berg)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 01 Apr 2007 14:43:08 +0200
parents f486526720c5
children 5dc0896d145a
files MoinMoin/user.py docs/CHANGES
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/user.py	Sun Apr 01 00:17:15 2007 +0200
+++ b/MoinMoin/user.py	Sun Apr 01 14:43:08 2007 +0200
@@ -362,7 +362,12 @@
                 key, val = line.strip().split('=', 1)
                 if key not in self._cfg.user_transient_fields and key[0] != '_':
                     # Decode list values
-                    if key in ['quicklinks', 'subscribed_pages']:
+                    if key.endswith('[]'):
+                        key = key[:-2]
+                        val = decodeList(val)
+                    # for compatibility reading old files, keep these explicit
+                    # we will store them with [] appended
+                    elif key in ['quicklinks', 'subscribed_pages']:
                         val = decodeList(val)
                     user_data[key] = val
             except ValueError:
@@ -522,7 +527,8 @@
         for key, value in attrs:
             if key not in self._cfg.user_transient_fields and key[0] != '_':
                 # Encode list values
-                if key in ['quicklinks', 'subscribed_pages']:
+                if isinstance(value, list):
+                    key += '[]'
                     value = encodeList(value)
                 line = u"%s=%s\n" % (key, unicode(value))
                 data.write(line)
--- a/docs/CHANGES	Sun Apr 01 00:17:15 2007 +0200
+++ b/docs/CHANGES	Sun Apr 01 14:43:08 2007 +0200
@@ -169,6 +169,10 @@
       invalidation based on global edit-log. We currently use it to cache page
       acls, speedup Page.get_rev and reading the page local edit-log.
     * Added wikiutil.renderText parse and format raw wiki markup with all page elements
+    * The user file format has changed, old files will be read correctly but
+      will silently be upgraded to the new format so old versions will not
+      read the new files correctly (this only affects 'subscribed_pages' and
+      'quicklinks' which will be lost when downgrading.)
 
   New Features:
     * The action menu now calls the actions for the revision of the page you