[GRASS-SVN] r65886 - in grass-addons/grass7/gui/wxpython/wx.metadata: db.csw.admin db.csw.harvest db.csw.run g.gui.metadata mdlib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Aug 11 03:24:59 PDT 2015


Author: krejcmat
Date: 2015-08-11 03:24:59 -0700 (Tue, 11 Aug 2015)
New Revision: 65886

Modified:
   grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.admin/db.csw.admin.py
   grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.harvest/db.csw.harvest.py
   grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.run/db.csw.run.py
   grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdeditorfactory.py
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdpdffactory.py
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdutil.py
Log:
wx.metadata addon: handle exception for imports

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.admin/db.csw.admin.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.admin/db.csw.admin.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.admin/db.csw.admin.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -127,9 +127,13 @@
 import getopt
 from cswutil import *
 import shutil
-from pycsw.core import admin, config
+try:
+    from pycsw.core import admin, config
+except:
+    sys.exit('pycsw library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 
 
+
 class CswAdmin():
     def __init__(self):
         self.COMMAND = None

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.harvest/db.csw.harvest.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.harvest/db.csw.harvest.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.harvest/db.csw.harvest.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -49,8 +49,12 @@
 import sys,os
 sys.path.insert(1, os.path.join(os.path.dirname(sys.path[0]), 'etc', 'mdlib'))
 from grass.script import core as grass
-from owslib.csw import CatalogueServiceWeb
-from owslib.ows import ExceptionReport
+try:
+    from owslib.csw import CatalogueServiceWeb
+    from owslib.ows import ExceptionReport
+except:
+    sys.exit('owslib python library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
+
 #from __future__ import absolute_import
 #from __future__ import print_function
 

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.run/db.csw.run.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.run/db.csw.run.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/db.csw.run/db.csw.run.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -81,8 +81,10 @@
 from grass.script import core as grass
 import contextlib
 
-
-from pycsw import server
+try:
+    from pycsw import server
+except:
+    sys.exit('pycsw library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 app_path=None
 
 @contextlib.contextmanager

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -37,7 +37,8 @@
 from wx.lib.buttons import ThemedGenBitmapTextButton as BitmapBtnTxt
 from wx import SplitterWindow
 import grass.script as grass
-from pydispatch import dispatcher
+#from pydispatch import dispatcher
+from grass.pydispatch import dispatcher
 
 import webbrowser
 

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -3,8 +3,11 @@
 import sys,os
 import grass.script as grass
 from modules.import_export import GdalImportDialog, GdalOutputDialog, ImportDialog
+try:
+    from owslib.csw import CatalogueServiceWeb
+except:
+    sys.exit('owslib python library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 
-from owslib.csw import CatalogueServiceWeb
 import webbrowser
 from cswutil import *
 import wx
@@ -21,7 +24,6 @@
 from owslib.fes import BBox, PropertyIsLike
 from owslib.ows import ExceptionReport
 import json
-import ipdb
 from core.utils import GetFormats
 from gui_core.forms import GUI
 from core.gcmd import RunCommand, GError, GMessage, GWarning
@@ -589,9 +591,7 @@
             data_url = item_data['wcs']
             self.gdalImport(False, data_url, type='wcs', evt=evt)
 
-            ipdb.set_trace()
 
-
     def GetQtype(self):  # TODO need to implement
         if self.qtypeRb.GetValue():
             return None

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdeditorfactory.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdeditorfactory.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdeditorfactory.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -31,10 +31,17 @@
 from wx import EVT_BUTTON
 import wx.lib.scrolledpanel as scrolled
 
-from owslib.iso import *
+try:
+    from owslib.iso import *
+except:
+    sys.exit('owslib library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 from mdjinjaparser import JinjaTemplateParser
-from jinja2 import Environment, FileSystemLoader
+try:
+    from jinja2 import Environment, FileSystemLoader
+except:
+    sys.exit('jinja2 library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 
+
 from core.gcmd import RunCommand, GError, GMessage
 from gui_core.widgets import IntegerValidator, NTCValidator, SimpleValidator,\
     TimeISOValidator, EmailValidator  # ,EmptyValidator
@@ -833,9 +840,6 @@
         return self.itemHolder# dict is in var keywordObj
 
     def fillDb(self):
-
-
-
         if not mdutil.isTableExists('metadata_themes'):
             sql='create table if not exists metadata_themes (title TEXT, keyword TEXT, date_iso TEXT ,date_type TEXT)'
             self.dbExecute(sql)
@@ -849,8 +853,7 @@
                 str=''
                 with open(path, "r") as inp :
                     exec(inp.read())
-
-                    for item in keywords:
+                    for item in keywords:#!!! from exec, no mistake
                             str+="('%s','%s','%s','%s'),"%(title[1],item['preferredLabel']['string'],'2010-01-13','publication')
                     str=str[:-1]
                     sql="INSERT INTO 'metadata_themes' ('title', 'keyword', 'date_iso' ,'date_type' ) VALUES"+str

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdgrass.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -15,9 +15,17 @@
 
 @author Matej Krejci <matejkrejci gmail.com> (GSoC 2014)
 """
-from owslib.iso import *
-from jinja2 import Environment, FileSystemLoader
+import sys
+try:
+    from owslib.iso import *
+except:
+    sys.exit('owslib library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
+try:
+    from jinja2 import Environment, FileSystemLoader
+except:
+    sys.exit('jinja2 library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 
+
 from lxml import etree
 import os
 

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdpdffactory.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdpdffactory.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdpdffactory.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -1,4 +1,7 @@
-from owslib.iso import *
+try:
+    from owslib.iso import *
+except:
+    sys.exit('owslib library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
 from reportlab.platypus import PageBreak
 import tempfile, sys, os
 import math

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdutil.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdutil.py	2015-08-11 09:53:42 UTC (rev 65885)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/mdutil.py	2015-08-11 10:24:59 UTC (rev 65886)
@@ -20,13 +20,18 @@
 
 @author Matej Krejci <matejkrejci gmail.com> (GSoC 2014)
 """
-from owslib.iso import *
+import os,sys
+
+try:
+    from owslib.iso import *
+except:
+    sys.exit('owslib library is missing. Check dependency on the manual page < https://grasswiki.osgeo.org/wiki/ISO/INSPIRE_Metadata_Support >')
+
 from owslib.namespaces import Namespaces
 from owslib.etree import etree
 from owslib import util
 
 import string
-import os
 from grass.script import core as grass
 from grass.pygrass.modules import Module
 from subprocess import PIPE



More information about the grass-commit mailing list