WebOb: MultiDict docs and behaviour oddness

67 views
Skip to first unread message

Ben Sizer

unread,
Apr 14, 2012, 8:46:02 AM4/14/12
to paste...@googlegroups.com
1) The link to MultiDict here - http://docs.webob.org/en/latest/reference.html#query-post-variables - is broken. I don't know if any other links are broken but it might be worth checking.

2) I found some docs for it here - http://readthedocs.org/docs/webob/en/latest/modules/webob.html - but the name (class webob.multidict.MultiDict) doesn't appear to 'work'.

>>> import webob
>>> x = webob.multidict.Multidict()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Multidict'

>>> import webob.multidict
>>> x = webob.multidict.Multidict()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Multidict'

Either I'm misunderstanding Python packages again - definitely a possibility! - or something is weird and/or wrong here.

3) The docs I found describe it as a normal dictionary, with some extra methods added. If that is the case, then why does a .get() return a KeyError if the item is not in the dictionary? I would expect it to return None.

  File "J:\code\pyprojects\pyramid_env\Web2\web2views.py", line 33, in edit_band
    band_id = request.POST.get("band_id") # may be 'none'
  File "J:\code\pyprojects\pyramid_env\lib\site-packages\webob\multidict.py", line 81, in __getitem__
    raise KeyError(key)
KeyError: 'band_id'

That's from a Pyramid app; I couldn't reproduce this with a more bare-bones example because I couldn't work out how to import a Multidict for a simpler test.

--
Ben Sizer


Wyatt Baldwin

unread,
Apr 14, 2012, 4:45:06 PM4/14/12
to paste...@googlegroups.com

On Saturday, April 14, 2012 5:46:02 AM UTC-7, Ben Sizer wrote:
1) The link to MultiDict here - http://docs.webob.org/en/latest/reference.html#query-post-variables - is broken. I don't know if any other links are broken but it might be worth checking.

2) I found some docs for it here - http://readthedocs.org/docs/webob/en/latest/modules/webob.html - but the name (class webob.multidict.MultiDict) doesn't appear to 'work'.

>>> import webob
>>> x = webob.multidict.Multidict()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Multidict'

>>> import webob.multidict
>>> x = webob.multidict.Multidict()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Multidict'

Either I'm misunderstanding Python packages again - definitely a possibility! - or something is weird and/or wrong here.
 
It looks like you spelled MultiDict incorrectly.

Ben Sizer

unread,
Apr 15, 2012, 6:57:54 AM4/15/12
to paste...@googlegroups.com
On Saturday, 14 April 2012 21:45:06 UTC+1, Wyatt wrote:

It looks like you spelled MultiDict incorrectly.

Hah! Well, that's one problem solved.

Anyone able to comment on the other?

--
Ben Sizer
 
Reply all
Reply to author
Forward
0 new messages