[Checkins] SVN: zope.app.apidoc/trunk/src/zope/app/apidoc/ Yipee, finally worked out the last bug in static apidoc!!!

Stephan Richter srichter at cosmos.phy.tufts.edu
Thu Sep 27 23:51:15 EDT 2007


Log message for revision 80267:
  Yipee, finally worked out the last bug in static apidoc!!!
  
  * There were some URLs that were not correctly normalized, so I fixed 
    that problem.
  
  * Also, one check required catching another exception.
  
  

Changed:
  U   zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/browser/zcml.py
  U   zope.app.apidoc/trunk/src/zope/app/apidoc/static.py

-=-
Modified: zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/browser/zcml.py
===================================================================
--- zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/browser/zcml.py	2007-09-28 00:00:39 UTC (rev 80266)
+++ zope.app.apidoc/trunk/src/zope/app/apidoc/codemodule/browser/zcml.py	2007-09-28 03:51:14 UTC (rev 80267)
@@ -97,7 +97,7 @@
             return
         try:
             isInterface = IInterface.providedBy(obj)
-        except AttributeError:
+        except (AttributeError, TypeError):
             # probably an object that does not like to play nice with the CA
             isInterface = False
 

Modified: zope.app.apidoc/trunk/src/zope/app/apidoc/static.py
===================================================================
--- zope.app.apidoc/trunk/src/zope/app/apidoc/static.py	2007-09-28 00:00:39 UTC (rev 80266)
+++ zope.app.apidoc/trunk/src/zope/app/apidoc/static.py	2007-09-28 03:51:14 UTC (rev 80267)
@@ -19,10 +19,12 @@
 
 import base64
 import os
+import os.path
 import sys
 import time
 import optparse
 import urllib2
+import urlparse
 import warnings
 import HTMLParser
 
@@ -80,7 +82,10 @@
     filename = url.split('/')[-1]
     if filename.startswith('@@'):
         url = url.replace(filename, filename[2:])
-    return url
+    # Now normalize the URL.
+    fragments = list(urlparse.urlparse(url))
+    fragments[2] = os.path.normpath(fragments[2])
+    return urlparse.urlunparse(fragments)
 
 
 class Link(object):
@@ -358,6 +363,7 @@
                 allow_xhtml=i_want_broken_xhtml_support),
             )
 
+
 class ApiDocLinksFactory(mechanize._html.LinksFactory):
     """Copy of mechanize link factory.
 



More information about the Checkins mailing list