[Python-checkins] python/dist/src/Tools/webchecker tktools.py,1.2,1.3 wcgui.py,1.8,1.9 webchecker.py,1.27,1.28 websucker.py,1.9,1.10 wsgui.py,1.5,1.6
doerwalter@users.sourceforge.net
doerwalter@users.sourceforge.net
Wed, 11 Sep 2002 13:36:04 -0700
Update of /cvsroot/python/python/dist/src/Tools/webchecker
In directory usw-pr-cvs1:/tmp/cvs-serv827/webchecker
Modified Files:
tktools.py wcgui.py webchecker.py websucker.py wsgui.py
Log Message:
Apply diff2.txt from SF patch http://www.python.org/sf/572113
(with one small bugfix in bgen/bgen/scantools.py)
This replaces string module functions with string methods
for the stuff in the Tools directory. Several uses of
string.letters etc. are still remaining.
Index: tktools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/tktools.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tktools.py 6 Apr 1998 14:29:20 -0000 1.2
--- tktools.py 11 Sep 2002 20:36:02 -0000 1.3
***************
*** 2,6 ****
- import string
from types import *
from Tkinter import *
--- 2,5 ----
***************
*** 336,340 ****
t = type(msg)
if t in (ListType, TupleType):
! msg = string.join(map(flatten, msg))
elif t is ClassType:
msg = msg.__name__
--- 335,339 ----
t = type(msg)
if t in (ListType, TupleType):
! msg = ' '.join(map(flatten, msg))
elif t is ClassType:
msg = msg.__name__
***************
*** 346,350 ****
def boolean(s):
"""Test whether a string is a Tk boolean, without error checking."""
! if string.lower(s) in ('', '0', 'no', 'off', 'false'): return 0
else: return 1
--- 345,349 ----
def boolean(s):
"""Test whether a string is a Tk boolean, without error checking."""
! if s.lower() in ('', '0', 'no', 'off', 'false'): return 0
else: return 1
Index: wcgui.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/wcgui.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** wcgui.py 17 Nov 1999 15:40:48 -0000 1.8
--- wcgui.py 11 Sep 2002 20:36:02 -0000 1.9
***************
*** 61,65 ****
import sys
import getopt
- import string
from Tkinter import *
import tktools
--- 61,64 ----
***************
*** 87,91 ****
for o, a in opts:
if o == '-m':
! webchecker.maxpage = string.atoi(a)
if o == '-q':
webchecker.verbose = 0
--- 86,90 ----
for o, a in opts:
if o == '-m':
! webchecker.maxpage = int(a)
if o == '-q':
webchecker.verbose = 0
***************
*** 170,174 ****
webchecker.Checker.__init__(self)
if root:
! root = string.strip(str(root))
if root:
self.suggestroot(root)
--- 169,173 ----
webchecker.Checker.__init__(self)
if root:
! root = str(root).strip()
if root:
self.suggestroot(root)
***************
*** 190,194 ****
def enterroot(self, event=None):
root = self.__rootentry.get()
! root = string.strip(root)
if root:
self.__checking.config(text="Adding root "+root)
--- 189,193 ----
def enterroot(self, event=None):
root = self.__rootentry.get()
! root = root.strip()
if root:
self.__checking.config(text="Adding root "+root)
***************
*** 354,358 ****
l = self.list.curselection()
if not l: return []
! return map(string.atoi, l)
def insert(self, url):
--- 353,357 ----
l = self.list.curselection()
if not l: return []
! return map(int, l)
def insert(self, url):
Index: webchecker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** webchecker.py 6 Jun 2002 17:01:21 -0000 1.27
--- webchecker.py 11 Sep 2002 20:36:02 -0000 1.28
***************
*** 110,114 ****
import os
from types import *
- import string
import StringIO
import getopt
--- 110,113 ----
***************
*** 125,129 ****
# Extract real version number if necessary
if __version__[0] == '$':
! _v = string.split(__version__)
if len(_v) == 3:
__version__ = _v[1]
--- 124,128 ----
# Extract real version number if necessary
if __version__[0] == '$':
! _v = __version__.split()
if len(_v) == 3:
__version__ = _v[1]
***************
*** 171,175 ****
dumpfile = a
if o == '-m':
! maxpage = string.atoi(a)
if o == '-n':
norun = 1
--- 170,174 ----
dumpfile = a
if o == '-m':
! maxpage = int(a)
if o == '-n':
norun = 1
***************
*** 177,181 ****
verbose = 0
if o == '-r':
! roundsize = string.atoi(a)
if o == '-t':
extra_roots.append(a)
--- 176,180 ----
verbose = 0
if o == '-r':
! roundsize = int(a)
if o == '-t':
extra_roots.append(a)
***************
*** 249,253 ****
if verbose > 0:
print "Done."
! print "Root:", string.join(c.roots, "\n ")
return c
--- 248,252 ----
if verbose > 0:
print "Done."
! print "Root:", "\n ".join(c.roots)
return c
***************
*** 317,321 ****
scheme, netloc, path, params, query, fragment = \
urlparse.urlparse(root)
! i = string.rfind(path, "/") + 1
if 0 < i < len(path):
path = path[:i]
--- 316,320 ----
scheme, netloc, path, params, query, fragment = \
urlparse.urlparse(root)
! i = path.rfind("/") + 1
if 0 < i < len(path):
path = path[:i]
***************
*** 545,549 ****
def checkforhtml(self, info, url):
if info.has_key('content-type'):
! ctype = string.lower(cgi.parse_header(info['content-type'])[0])
else:
if url[-1:] == "/":
--- 544,548 ----
def checkforhtml(self, info, url):
if info.has_key('content-type'):
! ctype = cgi.parse_header(info['content-type'])[0].lower()
else:
if url[-1:] == "/":
***************
*** 810,814 ****
for name, value in attributes:
if name == "rel":
! parts = string.split(string.lower(value))
if ( parts == ["stylesheet"]
or parts == ["alternate", "stylesheet"]):
--- 809,813 ----
for name, value in attributes:
if name == "rel":
! parts = value.lower().split()
if ( parts == ["stylesheet"]
or parts == ["alternate", "stylesheet"]):
***************
*** 837,841 ****
for name, value in attributes:
if name in args:
! if value: value = string.strip(value)
if value: self.links[value] = None
--- 836,840 ----
for name, value in attributes:
if name in args:
! if value: value = value.strip()
if value: self.links[value] = None
***************
*** 843,847 ****
for name, value in attributes:
if name == 'href':
! if value: value = string.strip(value)
if value:
if self.checker:
--- 842,846 ----
for name, value in attributes:
if name == 'href':
! if value: value = value.strip()
if value:
if self.checker:
Index: websucker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/websucker.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** websucker.py 25 Apr 2000 21:13:24 -0000 1.9
--- websucker.py 11 Sep 2002 20:36:02 -0000 1.10
***************
*** 7,11 ****
import os
import sys
- import string
import urllib
import getopt
--- 7,10 ----
***************
*** 15,19 ****
# Extract real version number if necessary
if __version__[0] == '$':
! _v = string.split(__version__)
if len(_v) == 3:
__version__ = _v[1]
--- 14,18 ----
# Extract real version number if necessary
if __version__[0] == '$':
! _v = __version__.split()
if len(_v) == 3:
__version__ = _v[1]
***************
*** 91,102 ****
type, rest = urllib.splittype(url)
host, path = urllib.splithost(rest)
! while path[:1] == "/": path = path[1:]
user, host = urllib.splituser(host)
host, port = urllib.splitnport(host)
! host = string.lower(host)
if not path or path[-1] == "/":
path = path + "index.html"
if os.sep != "/":
! path = string.join(string.split(path, "/"), os.sep)
if os.name == "mac":
path = os.sep + path
--- 90,101 ----
type, rest = urllib.splittype(url)
host, path = urllib.splithost(rest)
! path = path.lstrip("/")
user, host = urllib.splituser(host)
host, port = urllib.splitnport(host)
! host = host.lower()
if not path or path[-1] == "/":
path = path + "index.html"
if os.sep != "/":
! path = os.sep.join(path.split("/"))
if os.name == "mac":
path = os.sep + path
Index: wsgui.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/wsgui.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** wsgui.py 11 May 2001 19:40:10 -0000 1.5
--- wsgui.py 11 Sep 2002 20:36:02 -0000 1.6
***************
*** 9,13 ****
from Tkinter import *
import Tkinter
- import string
import websucker
import sys
--- 9,12 ----
***************
*** 151,155 ****
self.url_entry.selection_range(0, END)
url = self.url_entry.get()
! url = string.strip(url)
if not url:
self.top.bell()
--- 150,154 ----
self.url_entry.selection_range(0, END)
url = self.url_entry.get()
! url = url.strip()
if not url:
self.top.bell()
***************
*** 157,161 ****
return
self.rooturl = url
! dir = string.strip(self.dir_entry.get())
if not dir:
self.sucker.savedir = None
--- 156,160 ----
return
self.rooturl = url
! dir = self.dir_entry.get().strip()
if not dir:
self.sucker.savedir = None
***************
*** 185,189 ****
except TclError:
continue
! text = string.strip(text)
if text:
break
--- 184,188 ----
except TclError:
continue
! text = text.strip()
if text:
break