[Checkins]
SVN: grokui.introspector/trunk/src/grokui/introspector/util.py
Add helper for conversion from dotted name to HTML.
Uli Fouquet
uli at gnufix.de
Fri Jul 18 22:02:02 EDT 2008
Log message for revision 88561:
Add helper for conversion from dotted name to HTML.
Changed:
A grokui.introspector/trunk/src/grokui/introspector/util.py
-=-
Added: grokui.introspector/trunk/src/grokui/introspector/util.py
===================================================================
--- grokui.introspector/trunk/src/grokui/introspector/util.py (rev 0)
+++ grokui.introspector/trunk/src/grokui/introspector/util.py 2008-07-19 02:01:55 UTC (rev 88561)
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2008 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Helpers for the grokui.introspector.
+"""
+from grokui.introspector import NAMESPACE
+
+def dotted_name_url(dotted_path, preserve_last=0):
+ """Create an HTML fragment with links to parts of a dotted name.
+ """
+ result = []
+ parts = dotted_path.split('.', len(dotted_path.split('.'))
+ - 1 - preserve_last)
+ for i in range(0, len(parts)):
+ part = '<a href="/++%s++/code/%s">%s</a>' % (
+ NAMESPACE, '/'.join(parts[0:i+1]), parts[i])
+ result.append(part)
+ return '.'.join(result)
+
More information about the Checkins
mailing list