[Python-checkins] CVS: python/dist/src/Tools/webchecker webchecker.py,1.22,1.23

Fred L. Drake fdrake@users.sourceforge.net
Wed, 04 Apr 2001 10:47:27 -0700


Update of /cvsroot/python/python/dist/src/Tools/webchecker
In directory usw-pr-cvs1:/tmp/cvs-serv23716

Modified Files:
	webchecker.py 
Log Message:

A number of improvements based on a discussion with Chris McCafferty
<christopher.mccafferty@csg.ch>:

Add javascript: and telnet: to the types of URLs we ignore.

Add support for several additional URL-valued attributes on the BODY,
FRAME, IFRAME, LINK, OBJECT, and SCRIPT elements.


Index: webchecker.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/webchecker/webchecker.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -r1.22 -r1.23
*** webchecker.py	2000/03/28 20:10:39	1.22
--- webchecker.py	2001/04/04 17:47:25	1.23
***************
*** 482,487 ****
              return self.name_table[url]
  
!         if url[:7] == 'mailto:' or url[:5] == 'news:':
!             self.note(1, " Not checking mailto/news URL")
              return None
          isint = self.inroots(url)
--- 482,488 ----
              return self.name_table[url]
  
!         scheme = urllib.splittype(url)
!         if scheme in ('mailto', 'news', 'javascript', 'telnet'):
!             self.note(1, " Not checking %s URL" % scheme)
              return None
          isint = self.inroots(url)
***************
*** 793,800 ****
--- 794,822 ----
          self.link_attr(attributes, 'href')
  
+     def do_body(self, attributes):
+         self.link_attr(attributes, 'background')
+ 
      def do_img(self, attributes):
          self.link_attr(attributes, 'src', 'lowsrc')
  
      def do_frame(self, attributes):
+         self.link_attr(attributes, 'src', 'longdesc')
+ 
+     def do_iframe(self, attributes):
+         self.link_attr(attributes, 'src', 'longdesc')
+ 
+     def do_link(self, attributes):
+         for name, value in attributes:
+             if name == "rel":
+                 parts = string.split(string.lower(value))
+                 if (  parts == ["stylesheet"]
+                       or parts == ["alternate", "stylesheet"]):
+                     self.link_attr(attributes, "href")
+                     break
+ 
+     def do_object(self, attributes):
+         self.link_attr(attributes, 'data', 'usemap')
+ 
+     def do_script(self, attributes):
          self.link_attr(attributes, 'src')