Brian Ensor wrote:
>
>I do want to make the description field mandatory on list creation, so
>modifying the Mailman/Cgi/create.py is most likely the route I would like to
>pursue.
>
>In viewing the config and determining the changes to be made, I would be
>editing as follows:
>
>def process_request(doc, cgidata):
>    # Lowercase the listname since this is treated as the "internal" name.
>    listname = cgidata.getvalue('listname', '').strip().lower()
>    owner    = cgidata.getvalue('owner', '').strip()
>    # Added following line to support description field
>    description = cgidata.getvalue('description', '').strip()


Looks OK


># Sanity Check
>    # Added following line to support description field
>    if not description:
>        request_creation(doc, cgidata,
>                         _('You forgot to specify the list description'))
>        return


The issue here is _() is an i18n method to substitute text in the
appropriate language for the English text. As long as you're only
dealing in English, this won't be a problem, but this message won't be
available in other languages.


># And send the notice to the list owner.
>       # Added description to mlist 
>       text = Utils.maketext(
>            'newlist.txt',
>            {'listname'    : listname,
>             'password'    : password,
>             'admin_url'   : mlist.GetScriptURL('admin', absolute=1),
>             'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1),
>             'requestaddr' : mlist.GetRequestEmail(),
>             'siteowner'   : siteadmin,
>             'description' : description,
>             }, mlist=mlist)


This only adds 'description' and it's value to the dictionary for
interpolation into the template. You still need to edit the
newlist.txt template (see
http://www.python.org/cgi-bin/faqw-mm.py?req=show&file=faq04.048.htp)
to include appropriate text with '%(description)s' to receive the
description.


># in Dummy section modify page text to indicate requirement for description
>    <p>You also need to enter the email address of the initial list owner
>and
>    a brief description of the list. Once the list is created, the list
>owner
>    will be given notification, along with the initial list password.  The
>    list owner will then be able to modify the password and add or remove
>    additional list owners.
>
># Also in Dummy section
>    safedescription = Utils.websafe(cgidata.getvalue('description', ''))
>    ftable.AddRow([Label(_('Brief description of list:')),
>                   TextBox('description', safedescription)])
>    ftable.AddCellInfo(ftable.GetCurrentRowIndex(), 0, bgcolor=GREY)
>    ftable.AddCellInfo(ftable.GetCurrentRowIndex(), 1, bgcolor=GREY)
>
>
>I am not sure if the information above is 100% correct, but I believe it is.
>The part that is not addressed above is the actual list creation.  This is
>called by mlist.Create, which I believe is from the /Mailman/MailList.py
>file.  Here is how I believe the call should be done in create.py to
>accomplish what I want:
>
>                # Added description to this command line
>                mlist.Create(listname, owner, pw, langs, emailhost,
>description)


Do not change the mlist.Create() call.


>Now that I am passing another parameter, how can I ensure it is handled
>correctly?  Will there be some changes required in MailList.py or another
>file to make sure the field is handled correctly?  Is description the
>correct name to use?


You don't pass the parameter in the Create() call.

You 'update' it after the list is created. Just before the last
'finally:' in the outer of three 'try:'s around the Create() you'll see

        # Initialize the host_name and web_page_url attributes, based on
        # virtual hosting settings and the request environment
variables.
        mlist.default_member_moderation = moderate
        mlist.web_page_url = mm_cfg.DEFAULT_URL_PATTERN % hostname
        mlist.host_name = emailhost

add after this and before mlist.Save()

        mlist.description = description


--
Mark Sapiro <[EMAIL PROTECTED]>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

------------------------------------------------------
Mailman-Users mailing list
Mailman-Users@python.org
http://mail.python.org/mailman/listinfo/mailman-users
Mailman FAQ: http://www.python.org/cgi-bin/faqw-mm.py
Searchable Archives: http://www.mail-archive.com/mailman-users%40python.org/
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-users/archive%40jab.org

Security Policy: 
http://www.python.org/cgi-bin/faqw-mm.py?req=show&amp;file=faq01.027.htp

Reply via email to