versae / neo4j-rest-client

Object-oriented Python library to interact with Neo4j standalone REST server
http://neo4j-rest-client.rtfd.org
GNU General Public License v3.0
264 stars 73 forks source link

Calling node.labels.clear() fail #122

Closed ikus060 closed 8 years ago

ikus060 commented 8 years ago

A call to node.labels.clear() raise the following exception.

  File "/usr/local/lib/python2.7/dist-packages/neo4jrestclient/labels.py", line 231, in clear
    self._discard(label, return_label=False, raise_error=False)
  File "/usr/local/lib/python2.7/dist-packages/neo4jrestclient/labels.py", line 236, in _discard
    url = "{}/{}".format(self._url, smart_quote(label))
  File "/usr/local/lib/python2.7/dist-packages/neo4jrestclient/utils.py", line 26, in smart_quote
    safe_key = quote(val, safe="")
  File "/usr/lib/python2.7/urllib.py", line 1292, in quote
    if not s.rstrip(safe):
AttributeError: 'Label' object has no attribute 'rstrip'

Quici look to the code reveal the faulty line:

self._discard(label, return_label=False, raise_error=False)

discard should be called with a string. Not a label:

self._discard(label._label, return_label=False, raise_error=False)
versae commented 8 years ago

@ikus060 thanks for the catch! I'll take a look.