FAQ
I am running Mailman Version: 2.1.9 -- that cannot change since the
machine is running CentOS 4 and so has python 2.3.4 (the box will be upraded/rebuilt in a few months).

The traceback is below, since I don't speak python it doesn't mean much to me.
The list works, but the error below appears when anyone enters their email address
and tries to see their subscrition options.

I would be grateful if someone could give me some pointers as to what I have done
wrong.

Many thanks.


admin(21868): [----- Mailman Version: 2.1.9 -----]
admin(21868): [----- Traceback ------]
admin(21868): Traceback (most recent call last):
admin(21868): File "/usr/local/mailman/fridayfolk/scripts/driver", line 101, in run_main
admin(21868): main()
admin(21868): File "/usr/local/mailman/fridayfolk/Mailman/Cgi/options.py", line 93, in main
admin(21868): if not Utils.IsLanguage(language):
admin(21868): File "/usr/local/mailman/fridayfolk/Mailman/Utils.py", line 678, in IsLanguage
admin(21868): return mm_cfg.LC_DESCRIPTIONS.has_key(lang)
admin(21868): TypeError: list objects are unhashable
admin(21868): [----- Python Information -----]
admin(21868): sys.version = 2.3.4 (#1, Aug 8 2009, 09:59:27)


--
Alain Williams
Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
+44 (0) 787 668 0256 http://www.phcomp.co.uk/
Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
#include <std_disclaimer.h>

Search Discussions

  • Mark Sapiro at Jan 19, 2011 at 4:19 pm

    Alain Williams wrote:
    The traceback is below, since I don't speak python it doesn't mean much to me.
    The list works, but the error below appears when anyone enters their email address
    and tries to see their subscrition options.

    I would be grateful if someone could give me some pointers as to what I have done
    wrong.

    Many thanks.


    admin(21868): [----- Mailman Version: 2.1.9 -----]
    admin(21868): [----- Traceback ------]
    admin(21868): Traceback (most recent call last):
    admin(21868): File "/usr/local/mailman/fridayfolk/scripts/driver", line 101, in run_main
    admin(21868): main()
    admin(21868): File "/usr/local/mailman/fridayfolk/Mailman/Cgi/options.py", line 93, in main
    admin(21868): if not Utils.IsLanguage(language):
    admin(21868): File "/usr/local/mailman/fridayfolk/Mailman/Utils.py", line 678, in IsLanguage
    admin(21868): return mm_cfg.LC_DESCRIPTIONS.has_key(lang)
    admin(21868): TypeError: list objects are unhashable

    Someone has (hopefully in mm_cfg.py, but possibly by editing
    Defaults.py) redefined LC_DESCRIPTIONS as a list instead of a
    dictionary.

    If you don't know how to fix this, post your mm_cfg.py, and, if you've
    made changes to Defaults.py, see the FAQ at
    <http://wiki.list.org/x/fIA9> and post those too.

    Note that in any case, if you have something like

    LC_DESCRIPTIONS = []

    in mm_cfg.py, that is wrong on two counts. LC_DESCRIPTIONS is a
    dictionary and an empty dictionary is {}, not [], and if
    LC_DESCRIPTIONS is redefined in mm_cfg.py, add_language() will still
    update the original dictionary.

    The correct thing to put in mm_cfg.py for Mailman 2.1.9 if you want say
    English as the only language is

    LC_DESCRIPTIONS.clear()
    add_language('en', 'English (USA)', 'us-ascii')

    --
    Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan
  • Joshua J. Kugler at Jan 19, 2011 at 6:53 pm

    On Wednesday 19 January 2011, Mark Sapiro elucidated thus:
    Alain Williams wrote:
    The traceback is below, since I don't speak python it doesn't mean
    much to me. The list works, but the error below appears when anyone
    enters their email address and tries to see their subscrition
    options.

    I would be grateful if someone could give me some pointers as to
    what I have done wrong.

    Many thanks.


    admin(21868): [----- Mailman Version: 2.1.9 -----]
    admin(21868): [----- Traceback ------]
    admin(21868): Traceback (most recent call last):
    admin(21868): File "/usr/local/mailman/fridayfolk/scripts/driver",
    line 101, in run_main admin(21868): main()
    admin(21868): File
    "/usr/local/mailman/fridayfolk/Mailman/Cgi/options.py", line 93, in
    main admin(21868): if not Utils.IsLanguage(language):
    admin(21868): File
    "/usr/local/mailman/fridayfolk/Mailman/Utils.py", line 678, in
    IsLanguage admin(21868): return
    mm_cfg.LC_DESCRIPTIONS.has_key(lang) admin(21868): TypeError: list
    objects are unhashable
    Someone has (hopefully in mm_cfg.py, but possibly by editing
    Defaults.py) redefined LC_DESCRIPTIONS as a list instead of a
    dictionary.
    Actually, wouldn't 'lang' be the culprit here, as that is what is not
    hashable? If LC_DESCRIPTIONS was a list, the error would be:

    AttributeError: 'list' object has no attribute 'has_key'
    d = {}
    d.has_key([1,2,3])
    Traceback (most recent call last):
    File "<input>", line 1, in <module>
    TypeError: unhashable type: 'list'
    x = []
    x.has_key
    Traceback (most recent call last):
    File "<input>", line 1, in <module>
    AttributeError: 'list' object has no attribute 'has_key'
    >>>

    If you don't know how to fix this, post your mm_cfg.py, and, if
    you've made changes to Defaults.py, see the FAQ at
    <http://wiki.list.org/x/fIA9> and post those too.

    Note that in any case, if you have something like

    LC_DESCRIPTIONS = []

    in mm_cfg.py, that is wrong on two counts. LC_DESCRIPTIONS is a
    dictionary and an empty dictionary is {}, not [], and if
    LC_DESCRIPTIONS is redefined in mm_cfg.py, add_language() will still
    update the original dictionary.

    The correct thing to put in mm_cfg.py for Mailman 2.1.9 if you want
    say English as the only language is

    LC_DESCRIPTIONS.clear()
    add_language('en', 'English (USA)', 'us-ascii')


    --
    Joshua Kugler
    Part-Time System Admin/Programmer
    http://www.eeinternet.com - Fairbanks, AK
    PGP Key: http://pgp.mit.edu/ ?ID 0x73B13B6A
  • Mark Sapiro at Jan 19, 2011 at 9:43 pm

    Joshua J. Kugler wrote:
    On Wednesday 19 January 2011, Mark Sapiro elucidated thus:
    Alain Williams wrote:
    The traceback is below, since I don't speak python it doesn't mean
    much to me. The list works, but the error below appears when anyone
    enters their email address and tries to see their subscrition
    options.

    I would be grateful if someone could give me some pointers as to
    what I have done wrong.

    Many thanks.


    admin(21868): [----- Mailman Version: 2.1.9 -----]
    admin(21868): [----- Traceback ------]
    admin(21868): Traceback (most recent call last):
    admin(21868): File "/usr/local/mailman/fridayfolk/scripts/driver",
    line 101, in run_main admin(21868): main()
    admin(21868): File
    "/usr/local/mailman/fridayfolk/Mailman/Cgi/options.py", line 93, in
    main admin(21868): if not Utils.IsLanguage(language):
    admin(21868): File
    "/usr/local/mailman/fridayfolk/Mailman/Utils.py", line 678, in
    IsLanguage admin(21868): return
    mm_cfg.LC_DESCRIPTIONS.has_key(lang) admin(21868): TypeError: list
    objects are unhashable
    Someone has (hopefully in mm_cfg.py, but possibly by editing
    Defaults.py) redefined LC_DESCRIPTIONS as a list instead of a
    dictionary.
    Actually, wouldn't 'lang' be the culprit here, as that is what is not
    hashable?

    Yes, my bad. So, back to the original issue.

    I suspect this error occurs because somehow this list's language has
    been set to a list of languages rather than a single language.

    If you view the source of the list's listinfo page, you should see near
    the end something like

    <FORM Method=POST ACTION="../options/LISTNAME">
    To unsubscribe from LISTNAME, get a password reminder,
    or change your subscription options enter your subscription
    email address:
    <p><center> <INPUT name="email" type="TEXT" value="" size="30"
    <INPUT name="UserOptions" type="SUBMIT" value="Unsubscribe or edit
    options" ><INPUT name="language" type="HIDDEN" value="en" ></center>
    If you leave the field blank, you will be prompted for
    your email address
    </FORM>

    What is the value in the <INPUT name="language" type="HIDDEN" value= >
    element?

    --
    Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan
  • Alain Williams at Jan 19, 2011 at 11:31 pm

    On Wed, Jan 19, 2011 at 01:43:09PM -0800, Mark Sapiro wrote:
    Joshua J. Kugler wrote:
    ....
    Yes, my bad. So, back to the original issue.

    I suspect this error occurs because somehow this list's language has
    been set to a list of languages rather than a single language.

    If you view the source of the list's listinfo page, you should see near
    the end something like

    <FORM Method=POST ACTION="../options/LISTNAME">
    To unsubscribe from LISTNAME, get a password reminder,
    or change your subscription options enter your subscription
    email address:
    <p><center> <INPUT name="email" type="TEXT" value="" size="30"
    <INPUT name="UserOptions" type="SUBMIT" value="Unsubscribe or edit
    options" ><INPUT name="language" type="HIDDEN" value="en" ></center>
    If you leave the field blank, you will be prompted for
    your email address
    </FORM>

    What is the value in the <INPUT name="language" type="HIDDEN" value= >
    element?
    Ah, that gave me the clue to find it ....

    The form at the bottom of the page had become 2 overlapping forms,
    so looking at (near the bottom):

    /listinfo.html

    I saw:

    <TD COLSPAN="2" WIDTH="100%">
    <MM-Options-Form-Start>
    <MM-Editing-Options>
    <p>
    <MM-Roster-Form-Start>
    <MM-Roster-Option>
    <MM-Form-End>
    <p>
    <MM-Form-End>
    </td>

    Once I fixed it to:

    <TD COLSPAN="2" WIDTH="100%">
    <MM-Options-Form-Start>
    <MM-Editing-Options>
    <MM-Form-End>
    <p>
    <MM-Roster-Form-Start>
    <MM-Roster-Option>
    <MM-Form-End>
    </td>

    It all worked.

    So the problem was that there were 2 elements called 'language' in the form.
    Many thanks for the clue.

    Regards

    --
    Alain Williams
    Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer.
    +44 (0) 787 668 0256 http://www.phcomp.co.uk/
    Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php
    #include <std_disclaimer.h>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedJan 18, '11 at 11:28a
activeJan 19, '11 at 11:31p
posts5
users3
websitelist.org

People

Translate

site design / logo © 2022 Grokbase