[cig-commits] r11791 - in cs/portal/trunk/seismo/SeismoWebPortal: . templates/SeismoWebPortal

leif at geodynamics.org leif at geodynamics.org
Wed Apr 9 17:01:47 PDT 2008


Author: leif
Date: 2008-04-09 17:01:46 -0700 (Wed, 09 Apr 2008)
New Revision: 11791

Modified:
   cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/event_search_results.html
   cs/portal/trunk/seismo/SeismoWebPortal/views.py
Log:
Fixed a bug Matt found.


Modified: cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/event_search_results.html
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/event_search_results.html	2008-04-09 20:32:11 UTC (rev 11790)
+++ cs/portal/trunk/seismo/SeismoWebPortal/templates/SeismoWebPortal/event_search_results.html	2008-04-10 00:01:46 UTC (rev 11791)
@@ -1,6 +1,10 @@
 
 <h2>event search results</h2>
 
+{% if error %}
+<p><span class=error>{{ error }}</span></p>
+{% endif %}
+
 {% if event_list %}
     <table rules=groups class="cool">
         <colgroup><col class=odd><col class=even><col class=odd><col class=even><col class=odd><col class=even><col class=odd></colgroup>

Modified: cs/portal/trunk/seismo/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/seismo/SeismoWebPortal/views.py	2008-04-09 20:32:11 UTC (rev 11790)
+++ cs/portal/trunk/seismo/SeismoWebPortal/views.py	2008-04-10 00:01:46 UTC (rev 11791)
@@ -1617,7 +1617,8 @@
     results = gui.ChildWindow(resultsURL, "Results")
     html = loader.render_to_string('SeismoWebPortal/event_search_results.html',
                                    {'event_list': parser.cmtList,
-                                    'root': config.root})
+                                    'root': config.root,
+                                    'error': parser.error})
     results.content = gui.StaticContent(html)
     desktop.activeWindow.selectWindow(results)
     return desktop
@@ -1780,7 +1781,8 @@
     def __init__(self):
         HTMLParser.__init__(self)
         self.state = 0
-        self.cmtList = None
+        self.cmtList = []
+        self.error = None
         
     def handle_starttag(self, tag, attrs):
         if self.state == 0:
@@ -1789,6 +1791,9 @@
         elif self.state == 2:
             if tag == 'pre':
                 self.state = 3
+        elif self.state == -1:
+            if tag == 'p':
+                self.state = -2
         return
 
     def handle_endtag(self, tag):
@@ -1803,8 +1808,13 @@
         if self.state == 1:
             if data.find('Output in CMTSOLUTION format') != -1:
                 self.state = 2
+            elif data.startswith('CMT search error'):
+                self.state = -1
         elif self.state == 3:
             self.cmtList = CMTSolution.parse(data)
+        elif self.state == -2:
+            self.error = data
+            self.state = -3
         return
 
 



More information about the cig-commits mailing list