changeset 7:145a4d85b37d

exclude long urls for now ::sigh::
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 28 Dec 2010 20:38:08 -0800
parents a88a670c92d0
children 1d16bde33eee
files svgsitemap/middleware.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/svgsitemap/middleware.py
+++ b/svgsitemap/middleware.py
@@ -32,16 +32,17 @@ class MapserverMiddleware(object):
 class SVGSiteMap(object):
 
     ### class level variables
     defaults = { 'name': '',
                  'hosts': '',
                  'external_referers': True,
                  'maxwidth': 5,
                  'minwidth': '0.01',
+                 'maxlength': 80,
                  'excluded': '*.css *.js */static/* /css/* *.ico /backgrounds/*',
 
                  # input/output
                  'file': None, # graphviz file
                  'output': None, # .svg file
 
                  # graph attributes
                  'bgcolor': 'black',
@@ -181,16 +182,19 @@ class SVGSiteMap(object):
             self.graph.draw(self.output, prog='neato')
 
     def exclude(self, *urls):
         """tell whether the edge is excluded"""
         for pattern in self.excluded:
             for url in urls:
                 if fnmatch(url, pattern):
                     return True
+        for url in urls:
+            if len(url) > self.maxlength:
+                return True
         return False
 
     def set_widths(self):
         if self.maxwidth:
             for edge in self.graph.edges():
                 count = self.edges[(edge[0], edge[1])]
                 width = self.maxwidth * count / self.max
                 if not width: