[wwwsearch-commits] r17757 - wwwsearch/ClientForm/trunk

jjlee at codespeak.net jjlee at codespeak.net
Thu Sep 22 01:03:15 CEST 2005


Author: jjlee
Date: Thu Sep 22 01:03:15 2005
New Revision: 17757

Modified:
   wwwsearch/ClientForm/trunk/ClientForm.py
Log:
Remove use of module string

Modified: wwwsearch/ClientForm/trunk/ClientForm.py
==============================================================================
--- wwwsearch/ClientForm/trunk/ClientForm.py	(original)
+++ wwwsearch/ClientForm/trunk/ClientForm.py	Thu Sep 22 01:03:15 2005
@@ -82,7 +82,7 @@
         if expr: return True
         else: return False
 
-import sys, urllib, urllib2, types, string, mimetools, copy, urlparse, \
+import sys, urllib, urllib2, types, mimetools, copy, urlparse, \
        htmlentitydefs, re
 from urlparse import urljoin
 from cStringIO import StringIO
@@ -170,7 +170,7 @@
                     # loop over the sequence
                     for elt in v:
                         l.append(k + '=' + urllib.quote_plus(str(elt)))
-    return string.join(l, '&')
+    return '&'.join(l)
 
 def unescape(data, entities):
     if data is None or '&' not in data:
@@ -346,16 +346,16 @@
         """
         prefix is ignored if add_to_http_hdrs is true.
         """
-        lines = string.split(value, "\r\n")
+        lines = value.split("\r\n")
         while lines and not lines[-1]: del lines[-1]
         while lines and not lines[0]: del lines[0]
         if add_to_http_hdrs:
-            value = string.join(lines, "")
+            value = "".join(lines)
             self._http_hdrs.append((key, value))
         else:
             for i in range(1, len(lines)):
-                lines[i] = "    " + string.strip(lines[i])
-            value = string.join(lines, "\r\n") + "\r\n"
+                lines[i] = "    " + lines[i].strip()
+            value = "\r\n".join(lines) + "\r\n"
             line = key + ": " + value
             if prefix:
                 self._headers.insert(0, line)
@@ -460,9 +460,9 @@
             elif key == "action":
                 action = value
             elif key == "method":
-                method = string.upper(value)
+                method = value.upper()
             elif key == "enctype":
-                enctype = string.lower(value)
+                enctype = value.lower()
             d[key] = value
         controls = []
         self._current_form = (name, action, method, enctype), d, controls
@@ -536,7 +536,7 @@
         if self._option is None:
             raise ParseError("end of OPTION before start")
 
-        contents = string.strip(self._option.get("contents", ""))
+        contents = self._option.get("contents", "").strip()
         self._option["contents"] = contents
         if not self._option.has_key("value"):
             self._option["value"] = contents
@@ -1048,7 +1048,7 @@
     """
     def __init__(self, type, name, attrs):
         self._label = _getLabel(attrs)
-        self.__dict__["type"] = string.lower(type)
+        self.__dict__["type"] = type.lower()
         self.__dict__["name"] = name
         self._value = attrs.get("value")
         self.disabled = attrs.has_key("disabled")
@@ -1101,7 +1101,7 @@
         infos = []
         if self.disabled: infos.append("disabled")
         if self.readonly: infos.append("readonly")
-        info = string.join(infos, ", ")
+        info = ", ".join(infos)
         if info: info = " (%s)" % info
 
         return "<%s(%s=%s)%s>" % (self.__class__.__name__, name, value, info)
@@ -1212,12 +1212,12 @@
                     value.append("<Unnamed file>")
                 else:
                     value.append(filename)
-            value = string.join(value, ", ")
+            value = ", ".join(value)
 
         info = []
         if self.disabled: info.append("disabled")
         if self.readonly: info.append("readonly")
-        info = string.join(info, ", ")
+        info = ", ".join(info)
         if info: info = " (%s)" % info
 
         return "<%s(%s=%s)%s>" % (self.__class__.__name__, name, value, info)
@@ -1287,7 +1287,7 @@
         infos = []
         if self.disabled: infos.append("disabled")
         if self.readonly: infos.append("readonly")
-        info = string.join(infos, ", ")
+        info = ", ".join(infos)
         if info: info = " (%s)" % info
 
         return "<%s(%s)%s>" % (self.__class__.__name__, value, info)
@@ -1501,7 +1501,7 @@
         if not called_as_base_class:
             raise NotImplementedError()
 
-        self.__dict__["type"] = string.lower(type)
+        self.__dict__["type"] = type.lower()
         self.__dict__["name"] = name
         self._value = attrs.get("value")
         self.disabled = False
@@ -1937,11 +1937,11 @@
         infos = []
         if self.disabled: infos.append("disabled")
         if self.readonly: infos.append("readonly")
-        info = string.join(infos, ", ")
+        info = ", ".join(infos)
         if info: info = " (%s)" % info
 
         return "<%s(%s=[%s])%s>" % (self.__class__.__name__,
-                                    name, string.join(display, ", "), info)
+                                    name, ", ".join(display), info)
 
 
 class RadioControl(ListControl):
@@ -2486,7 +2486,7 @@
          called)
 
         """
-        type = string.lower(type)
+        type = type.lower()
         klass = self.type2class.get(type)
         if klass is None:
             if ignore_unknown:
@@ -2520,7 +2520,7 @@
         rep = [header]
         for control in self.controls:
             rep.append("  %s" % str(control))
-        return "<%s>" % string.join(rep, "\n")
+        return "<%s>" % "\n".join(rep)
 
 #---------------------------------------------------
 # Form-filling methods.
@@ -2894,7 +2894,7 @@
         if predicate is not None:
             description.append("predicate %s" % predicate)
         if orig_nr: description.append("nr %d" % orig_nr)
-        description = string.join(description, ", ")
+        description = ", ".join(description)
         raise ControlNotFoundError("no control matching "+description)
 
     def _click(self, name, type, id, label, nr, coord, return_type,
@@ -2921,7 +2921,7 @@
 
     def _request_data(self):
         """Return a tuple (url, data, headers)."""
-        method = string.upper(self.method)
+        method = self.method.upper()
         #scheme, netloc, path, parameters, query, frag = urlparse.urlparse(self.action)
         parts = urlparse.urlparse(self.action)
         rest, (query, frag) = parts[:-2], parts[-2:]


More information about the wwwsearch-commits mailing list