[csw-devel] SF.net SVN: opencsw:[384] utilities/site_links.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Jul 12 15:24:28 CEST 2011


Revision: 384
          http://opencsw.svn.sourceforge.net/opencsw/?rev=384&view=rev
Author:   wahwah
Date:     2011-07-12 13:24:28 +0000 (Tue, 12 Jul 2011)

Log Message:
-----------
site-linke: Clean whitespace

Don't try to print newlines in labels.

Modified Paths:
--------------
    utilities/site_links.py

Modified: utilities/site_links.py
===================================================================
--- utilities/site_links.py	2011-07-12 13:24:17 UTC (rev 383)
+++ utilities/site_links.py	2011-07-12 13:24:28 UTC (rev 384)
@@ -47,6 +47,12 @@
     s = s.lower()
     return "_".join(re.findall(r'\w+', s))
 
+
+def CleanWhiteSpace(s):
+    s = re.sub(r'\n', ' ', str(s))
+    s = " ".join(re.split(r'\s+', s))
+    return s
+
 def shorten(s, l):
     """It's pref + ... + post."""
     ndots = 3
@@ -174,7 +180,7 @@
             s.append("  %s -> %s [label=\"%s\"];" % (
                 identificatorify(site_from.name),
                 identificatorify(site_to.name),
-                shorten(link_data['text'], 30)))
+                CleanWhiteSpace(shorten(link_data['text'], 30))))
         s.append("}")
         return "\n".join(s)
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list