Update of /cvsroot/mailman/mailman/bin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29744

Modified Files:
      Tag: Release_2_1-maint
        newlist 
Log Message:
add options for hostnames in newlist command.


Index: newlist
===================================================================
RCS file: /cvsroot/mailman/mailman/bin/newlist,v
retrieving revision 2.16.2.2
retrieving revision 2.16.2.3
diff -u -d -r2.16.2.2 -r2.16.2.3
--- newlist     19 Oct 2004 05:07:42 -0000      2.16.2.2
+++ newlist     7 Nov 2004 11:56:52 -0000       2.16.2.3
@@ -23,10 +23,18 @@
 Options:
 
     -l language
-    --language language
+    --language=language
         Make the list's preferred language `language', which must be a two
         letter language code.
 
+    -u urlhost
+    --urlhost=urlhost
+        Gives the list's web interface host name.
+
+    -e emailhost
+    --emailhost=emailhost
+        Gives the list's email domain name.
+
     -q/--quiet
         Normally the administrator is notified by email (after a prompt) that
         their list has been created.  This option suppresses the prompt and
@@ -44,18 +52,35 @@
 multiple virtual Mailman sites, then the defaults may not be appropriate for
 the list you are creating.
 
-You can specify the domain to create your new list in by spelling the listname
+You also specify the domain to create your new list in by typing the command
 like so:
 
-    [EMAIL PROTECTED]
+    newlist --urlhost=www.mydom.ain mylist
 
 where `www.mydom.ain' should be the base hostname for the URL to this virtual
-hosts's lists.  E.g. with is setting people will view the general list
+hosts's lists.  E.g. with this setting people will view the general list
 overviews at http://www.mydom.ain/mailman/listinfo.  Also, www.mydom.ain
-should be a key in the VIRTUAL_HOSTS mapping in mm_cfg.py/Defaults.py.  It
-will be looked up to give the email hostname.  If this can't be found, then
-www.mydom.ain will be used for both the web interface and the email
-interface.
+should be a key in the VIRTUAL_HOSTS mapping in mm_cfg.py/Defaults.py if 
+the email hostname to be automatically determined.
+
+If you want the email hostname to be different from the one looked up by the
+VIRTUAL_HOSTS or if urlhost is not registered in VIRTUAL_HOSTS, you can specify
+`emailhost' like so:
+
+    newlist --urlhost=www.mydom.ain --emailhost=mydom.ain mylist
+
+where `mydom.ain' is the mail domain name. If you don't specify emailhost but
+urlhost is not in the virtual host list, then mm_cfg.DEFAULT_EMAIL_HOST will
+be used for the email interface.
+
+For backward compatibility, you can also specify the domain to create your
+new list in by spelling the listname like so:
+
+    [EMAIL PROTECTED]
+
+where www.mydom.ain is used for `urlhost' but it will also be used for
+`emailhost' if it is not found in the virtual host table. Note that
+'--urlhost' and '--emailhost' have precedence to this notation.
 
 If you spell the list name as just `mylist', then the email hostname will be
 taken from DEFAULT_EMAIL_HOST and the url will be taken from DEFAULT_URL (as
@@ -98,13 +123,16 @@
 
 def main():
     try:
-        opts, args = getopt.getopt(sys.argv[1:], 'hql:',
-                                   ['help', 'quiet', 'language='])
+        opts, args = getopt.getopt(sys.argv[1:], 'hql:u:e:',
+                                   ['help', 'quiet', 'language=',
+                                    'urlhost=', 'emailhost='])
     except getopt.error, msg:
         usage(1, msg)
 
     lang = mm_cfg.DEFAULT_SERVER_LANGUAGE
     quiet = 0
+    urlhost = None
+    emailhost = None
     for opt, arg in opts:
         if opt in ('-h', '--help'):
             usage(0)
@@ -112,6 +140,10 @@
             quiet = 1
         if opt in ('-l', '--language'):
             lang = arg
+        if opt in ('-u', '--urlhost'):
+            urlhost = arg
+        if opt in ('-e', '--emailhost'):
+            emailhost = arg
 
     # Is the language known?
     if lang not in mm_cfg.LC_DESCRIPTIONS.keys():
@@ -123,12 +155,16 @@
         listname = raw_input(_('Enter the name of the list: '))
     listname = listname.lower()
 
-    host_name = None
-    web_page_url = None
     if '@' in listname:
+        # note that --urlhost and --emailhost have precedence
         listname, domain = listname.split('@', 1)
-        host_name = mm_cfg.VIRTUAL_HOSTS.get(domain, domain)
-        web_page_url = mm_cfg.DEFAULT_URL_PATTERN % domain
+        urlhost = urlhost or domain
+        emailhost = emailhost or mm_cfg.VIRTUAL_HOSTS.get(domain, domain)
+
+    urlhost = urlhost or mm_cfg.DEFAULT_URL_HOST
+    host_name = emailhost or \
+                mm_cfg.VIRTUAL_HOSTS.get(urlhost, mm_cfg.DEFAULT_EMAIL_HOST)
+    web_page_url = mm_cfg.DEFAULT_URL_PATTERN % urlhost
 
     if Utils.list_exists(listname):
         usage(1, _('List already exists: %(listname)s'))
@@ -168,9 +204,8 @@
             usage(1, _('List already exists: %(listname)s'))
 
         # Assign domain-specific attributes
-        if host_name:
-            mlist.host_name = host_name
-            mlist.web_page_url = web_page_url
+        mlist.host_name = host_name
+        mlist.web_page_url = web_page_url
 
         # And assign the preferred language
         mlist.preferred_language = lang

_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to