changeset 17:94d9eccce1d7

prevent edge width breaking when new edges are added
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 02 Jan 2011 20:25:44 -0800
parents f50b4e4ad764
children 2aeac6508dc3
files svgsitemap/middleware.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/svgsitemap/middleware.py
+++ b/svgsitemap/middleware.py
@@ -163,21 +163,24 @@ class SVGSiteMap(object):
             count = self.edges[(from_url, to_url)]
             count += 1
             if count > self.max:
                 self.max = count
             self.edges[(from_url, to_url)] = count
             edge = self.graph.get_edge(from_url, to_url)
             self.label(edge, count)
         else:
+            count = 1
             self.edges[(from_url, to_url)] = 1
-            self.max = 1
             labeltooltip = '1: %s -> %s' % (from_url, to_url)
             self.graph.add_edge(from_url, to_url, label='', tooltip=labeltooltip, href='#')
 
+        if count > self.max:
+            self.max = count
+
         if self.maxwidth:
             self.set_widths()
 
         for url in from_url, to_url:
             node = self.graph.get_node(url)
             node.attr['label'] = url
             node.attr['href'] = url