[GRASS-SVN] r47195 - grass-addons/grass7/gui/wxpython/wx.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jul 21 07:06:56 EDT 2011
Author: sudeepsingh
Date: 2011-07-21 04:06:56 -0700 (Thu, 21 Jul 2011)
New Revision: 47195
Modified:
grass-addons/grass7/gui/wxpython/wx.wms/addserver.py
grass-addons/grass7/gui/wxpython/wx.wms/parse.py
grass-addons/grass7/gui/wxpython/wx.wms/serverList.txt
grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
Log:
Service Exception Handling added for Get Maps
Modified: grass-addons/grass7/gui/wxpython/wx.wms/addserver.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/addserver.py 2011-07-21 09:56:22 UTC (rev 47194)
+++ grass-addons/grass7/gui/wxpython/wx.wms/addserver.py 2011-07-21 11:06:56 UTC (rev 47195)
@@ -197,6 +197,7 @@
for k,v in self.servers.iteritems():
out.write(v.servername+" "+v.url+" "+v.username+" "+v.password+"\n")
exit()
+ #ServerAdd.Close()
#print "Event handler `OnQuit' not implemented"
event.Skip()
Modified: grass-addons/grass7/gui/wxpython/wx.wms/parse.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/parse.py 2011-07-21 09:56:22 UTC (rev 47194)
+++ grass-addons/grass7/gui/wxpython/wx.wms/parse.py 2011-07-21 11:06:56 UTC (rev 47195)
@@ -23,3 +23,18 @@
a=f.read()
print a
#parsexml(a) '''
+
+def isServiceException(xml):
+ print 'here'
+ #print xml
+ soup = BeautifulSoup(xml)
+ #print soup
+ exceptions = soup.findAll('ServiceException')
+ #print exceptions
+ exceptionList = []
+ xmltext = str(xml)
+ if(xmltext.count('ServiceException') > 0):
+ return True
+ else:
+ return False
+ print 'done'
Modified: grass-addons/grass7/gui/wxpython/wx.wms/serverList.txt
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/serverList.txt 2011-07-21 09:56:22 UTC (rev 47194)
+++ grass-addons/grass7/gui/wxpython/wx.wms/serverList.txt 2011-07-21 11:06:56 UTC (rev 47195)
@@ -1,2 +0,0 @@
-GisNetServer http://www.gisnet.lv/cgi-bin/topo
-VIZ_Globe http://viz.globe.gov/viz-bin/wmt.cgi
Modified: grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py 2011-07-21 09:56:22 UTC (rev 47194)
+++ grass-addons/grass7/gui/wxpython/wx.wms/wmsmenu.py 2011-07-21 11:06:56 UTC (rev 47195)
@@ -5,7 +5,7 @@
import wx
from wxPython.wx import *
from urllib2 import Request, urlopen, URLError, HTTPError
-from parse import parsexml
+from parse import parsexml, isServiceException
from WMSMapDisplay import NewImageFrame
from addserver import AddServerFrame
@@ -21,7 +21,7 @@
wx.Frame.__init__(self, *args, **kwds)
self.URL = wx.StaticText(self, -1, "URL")
self.ServerList = wx.ComboBox(self, -1, choices=[], style=wx.CB_DROPDOWN|wx.CB_SIMPLE)
- self.LayerTree = wx.TreeCtrl(self, -1, style=wx.TR_HAS_BUTTONS|wx.TR_NO_LINES|wx.TR_DEFAULT_STYLE|wx.SUNKEN_BORDER)
+ self.LayerTree = wx.TreeCtrl(self, -1, style=wx.TR_HAS_BUTTONS|wx.TR_NO_LINES|wx.TR_MULTIPLE|wx.TR_MULTIPLE|wx.TR_DEFAULT_STYLE|wx.SUNKEN_BORDER)
self.GetCapabilities = wx.Button(self, -1, "GetCapabilities")
self.GetMaps = wx.Button(self, -1, "GetMaps")
self.addServer = wx.Button(self, -1, "AddServer")
@@ -136,14 +136,16 @@
try:
response = urlopen(req)
image = response.read()
- outfile = open('map.png','wb')
- outfile.write(image)
- outfile.close()
+ #print image
+ if(isServiceException(image)):
+ print 'Service Exception has occured'
+ else:
+ outfile = open('map.png','wb')
+ outfile.write(image)
+ outfile.close()
+ NewImageFrame()
- NewImageFrame()
-
-
except HTTPError, e:
print 'The server couldn\'t fulfill the request.'
print 'Error code: ', e.code
More information about the grass-commit
mailing list