Skip to content
This repository

Fix bug in remove method, it always remove port field #14

Closed
wants to merge 1 commit into from

2 participants

Stéphane Klein gruns
Stéphane Klein

Hi,

can you pull this small bug fix ? :)

Best regards,
Stephane

gruns gruns referenced this pull request from a commit
Fixed bug #14 - furl.remove() removed port, username, and password ev…
…en if they weren't specifed to be removed. Added equality operator to furl.
b1d3f7e
gruns
Owner

Great find.

I incorporated your fix and a few others into furl v0.3.3.

>>> f = furl('http://pumps.com:8000')
>>> f.url
'http://pumps.com:8000'
>>> f.remove()
>>> f.url
'http://pumps.com:8000'

Update with

pip install furl --upgrade

Thanks for bringing this issue to my attention Stephane.

gruns gruns closed this
Stéphane Klein

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 10, 2012
Stéphane Klein Fix bug in remove method, it always remove port field b266cbd
This page is out of date. Refresh to see the latest.
3  .gitignore
... ...
@@ -0,0 +1,3 @@
  1
+*.pyc
  2
+env1/
  3
+furl.egg-info/
2  furl/furl.py
@@ -956,7 +956,7 @@ def remove(self, args=_absent, path=_absent, fragment=_absent, query=_absent,
956 956
       self.username = ''
957 957
     if password:
958 958
       self.password = ''
959  
-    if port:
  959
+    if port is not _absent:
960 960
       self.port = None
961 961
 
962 962
     if path is not _absent:
6  tests/test_furl.py
@@ -911,6 +911,12 @@ def test_basics(self):
911 911
     assert f.url == str(f) == query_quoted
912 912
     assert f.url == furl.furl(f).url == furl.furl(f.url).url
913 913
     assert f is not f.copy() and f.url == f.copy().url
  914
+    f.add({'page': 1})
  915
+    assert f.url == 'sup://192.168.1.102:8080///one//a%20b////?s=kwl+string&page=1#frag'
  916
+    f.remove('page')
  917
+    assert f.url == 'sup://192.168.1.102:8080///one//a%20b////?s=kwl+string#frag'
  918
+
  919
+
914 920
 
915 921
     # URL paths are always absolute if not empty.
916 922
     f = furl.furl()
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.