Browse files

cleanup baseurl usage

  • Loading branch information...
1 parent 5cc8962 commit 282243657deaeabed718830f0c83e1e289fbe7f3 @baverman committed Mar 24, 2013
Showing with 5 additions and 6 deletions.
  1. +1 −2 swoop/form.py
  2. +1 −4 swoop/request.py
  3. +3 −0 swoop/session.py
View
3 swoop/form.py
@@ -94,8 +94,7 @@ def get_request_for_form(response, action=None, id=None, idx=None, name=None, su
'action=[%s] id=[%s] name=[%s]' % (str(action), str(id), str(name)))
form = forms[0]
- request = Request(
- urlparse.urljoin(response.url, form.attrib.get('action', response.url)),
+ request = Request(response.url, form.attrib.get('action', response.url),
session_ref=response.session_ref)
submit_already_added = submit is False
View
5 swoop/request.py
@@ -9,10 +9,7 @@
class Request(object):
def __init__(self, url, baseurl=None, session_ref=None):
if baseurl:
- if isinstance(baseurl, Request):
- baseurl = baseurl.url
-
- url = urljoin(baseurl.get_url(), url)
+ url = urljoin(baseurl, url)
self.session_ref = session_ref
View
3 swoop/session.py
@@ -83,6 +83,9 @@ def __call__(self, request):
return Response(self, response, response_data)
def request(self, url, baseurl=None):
+ if isinstance(baseurl, (Request, Response)):
+ baseurl = baseurl.url
+
return Request(url, baseurl, ref(self))
def clear(self):

0 comments on commit 2822436

Please sign in to comment.