[Zope3-checkins] SVN: Zope3/trunk/ Fixed ftest failure in release
package, since I hard-coded truncating the
Stephan Richter
srichter at cosmos.phy.tufts.edu
Sat Jun 18 10:41:18 EDT 2005
Log message for revision 30840:
Fixed ftest failure in release package, since I hard-coded truncating the
path of ZCML files. It is now fixed and works in the release.
Changed:
A Zope3/trunk/package-includes/apidoc-ftesting.zcml
U Zope3/trunk/src/zope/app/apidoc/component.py
A Zope3/trunk/src/zope/app/apidoc/ftesting.zcml
U Zope3/trunk/src/zope/app/apidoc/utilities.py
U Zope3/trunk/src/zope/app/apidoc/utilities.txt
-=-
Added: Zope3/trunk/package-includes/apidoc-ftesting.zcml
===================================================================
--- Zope3/trunk/package-includes/apidoc-ftesting.zcml 2005-06-18 13:55:07 UTC (rev 30839)
+++ Zope3/trunk/package-includes/apidoc-ftesting.zcml 2005-06-18 14:41:18 UTC (rev 30840)
@@ -0,0 +1 @@
+<include package="zope.app.apidoc" file="ftesting.zcml" />
Property changes on: Zope3/trunk/package-includes/apidoc-ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope3/trunk/src/zope/app/apidoc/component.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/component.py 2005-06-18 13:55:07 UTC (rev 30839)
+++ Zope3/trunk/src/zope/app/apidoc/component.py 2005-06-18 14:41:18 UTC (rev 30840)
@@ -26,8 +26,8 @@
from zope.app import zapi
from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.app.apidoc.utilities import getPythonPath, relativizePath
-from zope.app.apidoc.utilities import renderText
+from zope.app.apidoc.utilities import relativizePath, truncateSysPath
+from zope.app.apidoc.utilities import getPythonPath, renderText
from zope.app.apidoc.classregistry import classRegistry
SPECIFIC_INTERFACE_LEVEL = 1
@@ -149,7 +149,7 @@
def getParserInfoInfoDictionary(info):
"""Return a PT-friendly info dictionary for a parser info object."""
return {'file': relativizePath(info.file),
- 'url': relativizePath(info.file)[10:].replace('\\', '/'),
+ 'url': truncateSysPath(info.file).replace('\\', '/'),
'line': info.line,
'eline': info.eline,
'column': info.column,
Added: Zope3/trunk/src/zope/app/apidoc/ftesting.zcml
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/ftesting.zcml 2005-06-18 13:55:07 UTC (rev 30839)
+++ Zope3/trunk/src/zope/app/apidoc/ftesting.zcml 2005-06-18 14:41:18 UTC (rev 30840)
@@ -0,0 +1,3 @@
+<configure xmlns:apidoc="http://namespaces.zope.org/apidoc">
+ <apidoc:moduleImport allow="true" />
+</configure>
\ No newline at end of file
Property changes on: Zope3/trunk/src/zope/app/apidoc/ftesting.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: Zope3/trunk/src/zope/app/apidoc/utilities.py
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilities.py 2005-06-18 13:55:07 UTC (rev 30839)
+++ Zope3/trunk/src/zope/app/apidoc/utilities.py 2005-06-18 14:41:18 UTC (rev 30840)
@@ -45,6 +45,14 @@
return path.replace(BASEDIR, 'Zope3')
+def truncateSysPath(path):
+ """Remove the system path prefix from the path."""
+ for syspath in sys.path:
+ if path.startswith(syspath):
+ return path.replace(syspath, '')[1:]
+ return path
+
+
class ReadContainerBase(object):
"""Base for `IReadContainer` objects."""
implements(IReadContainer)
Modified: Zope3/trunk/src/zope/app/apidoc/utilities.txt
===================================================================
--- Zope3/trunk/src/zope/app/apidoc/utilities.txt 2005-06-18 13:55:07 UTC (rev 30839)
+++ Zope3/trunk/src/zope/app/apidoc/utilities.txt 2005-06-18 14:41:18 UTC (rev 30840)
@@ -41,6 +41,26 @@
'foo/bar/blah.txt'
+`truncateSysPath(path)`
+----------------------
+
+In some cases it is useful to just know the path after the sys path of a
+module. For example, you have a path of a file in a module. To look up the
+module, the simplest to do is to retrieve the module path and look into the
+system's modules list.
+
+ >>> import sys
+ >>> sysBase = sys.path[0]
+
+ >>> utilities.truncateSysPath(sysBase + '/some/module/path')
+ 'some/module/path'
+
+If there is no matching system path, then the whole path is returned:
+
+ >>> utilities.truncateSysPath('some/other/path')
+ 'some/other/path'
+
+
`ReadContainerBase` (Class)
---------------------------
More information about the Zope3-Checkins
mailing list