changeset 17:4a9ceda73d92

check for data before writing to it
author k0s <k0scist@gmail.com>
date Fri, 20 Nov 2009 16:42:57 -0500
parents 15cc68a342b0
children 24cd9c7749ce
files genshi_view/template/+package+/dispatcher.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/genshi_view/template/+package+/dispatcher.py	Fri Nov 20 16:33:10 2009 -0500
+++ b/genshi_view/template/+package+/dispatcher.py	Fri Nov 20 16:42:57 2009 -0500
@@ -53,10 +53,11 @@
             handler = exc.HTTPNotFound
 
         # add navigation links to handler [example]
-        handler.data.setdefault('links', [])
-        for h in self.handlers:
-            handler.data['links'].append((handler.link(h.handler_path), 
-                                          h.__name__))
+        if hasattr(handler, 'data'):
+            handler.data.setdefault('links', [])
+            for h in self.handlers:
+                handler.data['links'].append((handler.link(h.handler_path), 
+                                              h.__name__))
 
         # get response
         res = handler()