[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mailman-cvs
Subject:    [Mailman-checkins] SF.net SVN: mailman: [8226]
From:       bwarsaw () users ! sourceforge ! net
Date:       2007-05-29 15:03:34
Message-ID: E1Ht3EU-0000SO-7a () sc8-pr-svn1 ! sourceforge ! net
[Download RAW message or body]

Revision: 8226
          http://svn.sourceforge.net/mailman/?rev=8226&view=rev
Author:   bwarsaw
Date:     2007-05-29 08:03:15 -0700 (Tue, 29 May 2007)

Log Message:
-----------
Support resetting a user's password if the imported file does not have a
password for the user, or if it's "{NONE}".

Modified Paths:
--------------
    trunk/mailman/Mailman/bin/import.py

Modified: trunk/mailman/Mailman/bin/import.py
===================================================================
--- trunk/mailman/Mailman/bin/import.py	2007-05-29 15:01:32 UTC (rev 8225)
+++ trunk/mailman/Mailman/bin/import.py	2007-05-29 15:03:15 UTC (rev 8226)
@@ -30,13 +30,16 @@
 from Mailman import MemberAdaptor
 from Mailman import Utils
 from Mailman import Version
+from Mailman import passwords
 from Mailman.MailList import MailList
 from Mailman.i18n import _
 from Mailman.initialize import initialize
 
 __i18n_templates__ = True
 
+OPTS = None
 
+
 
 def nodetext(node):
     # Expect only one TEXT_NODE in the list of children
@@ -123,7 +126,7 @@
         if not mid:
             print _('Skipping member with no id')
             continue
-        if VERBOSE:
+        if OPTS.verbose:
             print _('* Processing member: $mid')
         for subnode in nodegen(child):
             attr = subnode.tagName
@@ -138,6 +141,10 @@
                 value = []
                 for subsubnode in nodegen(subnode):
                     value.append(nodetext(subsubnode))
+            elif attr == 'password':
+                value = nodetext(subnode)
+                if OPTS.reset_passwords or value == '{NONE}' or not value:
+                    value = passwords.make_secret(Utils.MakeRandomPassword())
             else:
                 value = nodetext(subnode)
             member[attr] = value
@@ -168,7 +175,7 @@
     for listnode in nodegen(top, 'list'):
         listdata = dict()
         name = listnode.getAttribute('name')
-        if VERBOSE:
+        if OPTS.verbose:
             print _('Processing list: $name')
         if not name:
             print _('Ignoring malformed <list> node')
@@ -192,7 +199,7 @@
             continue
         mlist = MailList()
         try:
-            if VERBOSE:
+            if OPTS.verbose:
                 print _('Creating mailing list: $fqdn_listname')
             mlist.Create(fqdn_listname, list_config['owner'][0],
                          list_config['password'])
@@ -229,7 +236,7 @@
                     setattr(mlist, option, value)
             for member in list_roster:
                 mid = member['id']
-                if VERBOSE:
+                if OPTS.verbose:
                     print _('* Adding member: $mid')
                 status, delivery = member['delivery']
                 kws = {'password'   : member['password'],
@@ -290,11 +297,11 @@
 
 
 def main():
-    global VERBOSE
+    global OPTS
 
     parser, opts, args = parseargs()
     initialize(opts.config)
-    VERBOSE = opts.verbose
+    OPTS = opts
 
     if opts.inputfile in (None, '-'):
         fp = sys.stdin


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site. _______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: http://mail.python.org/mailman/options/mailman-checkins/mailman-cvs%40progressive-comp.com



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic