jinglemansweep/PyLMS

import urllib needed in server.request_with_results

Closed this issue · 2 comments

What steps will reproduce the problem?
serverobject.request_with_results("favorites items 0 1")

What is the expected output? What do you see instead?
Expected: (x, [{...}], True)
(0, [], False) is returned.

What version of the product are you using? ver 0.95 on Python 2.7
On what operating system? on WinXP

Please provide any additional information below.
In server.py the server.request_with_results method the following line raises an exception:
quotedColon = urllib.quote(':')

The problem is that urllib has not been imported. Adding "import urllib" at the top of the method fixes the problem and the correct results are returned.

There's also another reference to urllib farther down in the method:
item[urllib.unquote(key)] = self.__unquote(value)

The following change fixes the problem:
item[self.__unquote(value)] = self.__unquote(value)

If last change is made then the "import urllib" line can be removed and so can the "quotedColon = urllib.quote(':')" line.

  • The second line can be removed because quotedColon is set as the first statement in the method.

Thanks for the code,

Mike
Delete comment

In the Expected output area above I switched the booleans. The following should be used instead:
Expected: (x, [{...}], False)
(0, [], True) is returned.

Mike

Argh.

Actually the line "has" to be
item[urllib.unquote(key)] = self.__unquote(value)

The other way returns results but it strips the key names used in the dictionary.

The easiest fix is to just add "import urllib" to the top of the method and call it good.

Mike