comparison svgsitemap/middleware.py @ 4:84344f9ed3f8

handle startup case
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 28 Dec 2010 16:59:58 -0800
parents 30d03e830354
children 65acb32e8dc3
comparison
equal deleted inserted replaced
3:fc09a7ffb767 4:84344f9ed3f8
147 self.edges[(from_url, to_url)] = count 147 self.edges[(from_url, to_url)] = count
148 edge = self.graph.get_edge(from_url, to_url) 148 edge = self.graph.get_edge(from_url, to_url)
149 edge.attr['label'] = str(count) 149 edge.attr['label'] = str(count)
150 else: 150 else:
151 self.edges[(from_url, to_url)] = 1 151 self.edges[(from_url, to_url)] = 1
152 self.max = 1
152 self.graph.add_edge(from_url, to_url, label='1') 153 self.graph.add_edge(from_url, to_url, label='1')
153 154
154 for edge in self.graph.edges(): 155 for edge in self.graph.edges():
155 count = self.edges[(edge[0], edge[1])] 156 count = self.edges[(edge[0], edge[1])]
156 width = self.maxwidth * count / self.max 157 width = self.maxwidth * count / self.max