[Checkins]
SVN: grokui.introspector/trunk/src/grokui/introspector/util.txt
Tests for the package helpers.
Uli Fouquet
uli at gnufix.de
Fri Jul 18 22:02:47 EDT 2008
Log message for revision 88562:
Tests for the package helpers.
Changed:
A grokui.introspector/trunk/src/grokui/introspector/util.txt
-=-
Added: grokui.introspector/trunk/src/grokui/introspector/util.txt
===================================================================
--- grokui.introspector/trunk/src/grokui/introspector/util.txt (rev 0)
+++ grokui.introspector/trunk/src/grokui/introspector/util.txt 2008-07-19 02:02:37 UTC (rev 88562)
@@ -0,0 +1,39 @@
+grokui.introspector.util
+************************
+
+:Test-Layer: unit
+
+Helpers for the ``grokui.introspector`` package.
+
+dotted_name_url
+===============
+
+Create a URL out of a dotted name.
+
+We get an HTML fragment, which provides links to every part of the
+dotted name. As an example we generate the fragment which provides us
+a link to the ``zope`` package::
+
+ >>> from grokui.introspector.util import dotted_name_url
+ >>> dotted_name_url('zope')
+ u'<a href="/++introspector++/code/zope">zope</a>'
+
+The HTML for the ``zope.introspector`` package is the same but a link
+to the ``introspector subpackage appended::
+
+ >>> dotted_name_url('zope.introspector')
+ u'...<a href="/++introspector++/code/zope/introspector">introspector</a>'
+
+If we want a part of the dotted path to persist, for instance, because
+it is not an individual part of the dotted name but a file extension,
+we can do so by providing the `preserve_last` option::
+
+ >>> dotted_name_url('zope.README.txt', preserve_last=1)
+ u'...<a href="/++introspector++/code/zope/README.txt">README.txt</a>'
+
+The default value for `preserve_last` is zero, which means that every
+dot in the dotted name means a new component. Larger values handle
+also components with more than one dot in their name::
+
+ >>> dotted_name_url('zope.README.txt.gz', preserve_last=2)
+ u'...<a href="/++introspector++/code/zope/README.txt.gz">README.txt.gz</a>'
More information about the Checkins
mailing list