[wwwsearch-commits] r22968 - wwwsearch/mechanize/trunk/mechanize

jjlee at codespeak.net jjlee at codespeak.net
Fri Feb 3 00:59:03 CET 2006


Author: jjlee
Date: Fri Feb  3 00:59:03 2006
New Revision: 22968

Modified:
   wwwsearch/mechanize/trunk/mechanize/_mechanize.py
Log:
Rename cleanUrl-->clean_url; Replace code with call to clean_url()

Modified: wwwsearch/mechanize/trunk/mechanize/_mechanize.py
==============================================================================
--- wwwsearch/mechanize/trunk/mechanize/_mechanize.py	(original)
+++ wwwsearch/mechanize/trunk/mechanize/_mechanize.py	Fri Feb  3 00:59:03 2006
@@ -90,7 +90,7 @@
             self.base_url, self.url, self.text, self.tag, self.attrs)
 
 
-def cleanUrl(url, encoding):
+def clean_url(url, encoding):
     # percent-encode illegal URL characters
     if type(url) == type(""):
         url = url.decode(encoding, "replace")
@@ -142,7 +142,7 @@
                 # this.
                 continue
 
-            url = cleanUrl(url, encoding)
+            url = clean_url(url, encoding)
             if tag == "a":
                 if token.type != "startendtag":
                     # hmm, this'd break if end tag is missing
@@ -340,9 +340,7 @@
                 url = attrs_dict.get(url_attr)
                 if not url:
                     continue
-                if type(url) == type(""):
-                    url = url.decode(encoding, "replace")
-                url = urllib.quote(url.encode(encoding), URLQUOTE_SAFE_URL_CHARS)
+                url = clean_url(url)
                 text = link.firstText(lambda t: True)
                 if text is BeautifulSoup.Null:
                     # follow pullparser's weird behaviour rigidly


More information about the wwwsearch-commits mailing list