[GRASS-SVN] r54903 - in grass/trunk/lib/python/pygrass: . modules vector
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Feb 4 08:02:21 PST 2013
Author: lucadelu
Date: 2013-02-04 08:02:17 -0800 (Mon, 04 Feb 2013)
New Revision: 54903
Modified:
grass/trunk/lib/python/pygrass/__init__.py
grass/trunk/lib/python/pygrass/errors.py
grass/trunk/lib/python/pygrass/modules/__init__.py
grass/trunk/lib/python/pygrass/vector/table.py
Log:
move classes for errors in errors.py
Modified: grass/trunk/lib/python/pygrass/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/__init__.py 2013-02-04 15:26:47 UTC (rev 54902)
+++ grass/trunk/lib/python/pygrass/__init__.py 2013-02-04 16:02:17 UTC (rev 54903)
@@ -9,9 +9,9 @@
import os as _os
import sys as _sys
+import errors
import gis
+import functions
import raster
import vector
import modules
-import errors
-import functions
Modified: grass/trunk/lib/python/pygrass/errors.py
===================================================================
--- grass/trunk/lib/python/pygrass/errors.py 2013-02-04 15:26:47 UTC (rev 54902)
+++ grass/trunk/lib/python/pygrass/errors.py 2013-02-04 16:02:17 UTC (rev 54903)
@@ -8,7 +8,7 @@
from grass.script import warning
-class GrassError(Exception):
+class AbstractError(Exception):
def __init__(self, value):
self.value = value
@@ -16,14 +16,26 @@
return repr(self.value)
-class OpenError(Exception):
- def __init__(self, value):
- self.value = value
+class ParameterError(Exception):
+ pass
- def __str__(self):
- return repr(self.value)
+class FlagError(Exception):
+ pass
+
+class DBError(AbstractError):
+ pass
+
+
+class GrassError(AbstractError):
+ pass
+
+
+class OpenError(AbstractError):
+ pass
+
+
def must_be_open(method):
def wrapper(self, *args, **kargs):
if self.is_open():
Modified: grass/trunk/lib/python/pygrass/modules/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/modules/__init__.py 2013-02-04 15:26:47 UTC (rev 54902)
+++ grass/trunk/lib/python/pygrass/modules/__init__.py 2013-02-04 16:02:17 UTC (rev 54903)
@@ -20,7 +20,7 @@
import grass
-from grass.pygrass.errors import GrassError
+from grass.pygrass.errors import GrassError, ParameterError, FlagError
#
# this dictionary is used to extract the value of interest from the xml
@@ -54,14 +54,6 @@
}
-class ParameterError(Exception):
- pass
-
-
-class FlagError(Exception):
- pass
-
-
def _element2dict(xparameter):
diz = dict(xparameter.items())
for p in xparameter:
Modified: grass/trunk/lib/python/pygrass/vector/table.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/table.py 2013-02-04 15:26:47 UTC (rev 54902)
+++ grass/trunk/lib/python/pygrass/vector/table.py 2013-02-04 16:02:17 UTC (rev 54903)
@@ -16,6 +16,7 @@
import grass.lib.vector as libvect
from grass.pygrass.gis import Mapset
+from grass.pygrass.errors import DBError
import sql
@@ -23,14 +24,6 @@
DRIVERS = ('sqlite', 'pg')
-class DBError(Exception):
- def __init__(self, value):
- self.value = value
-
- def __str__(self):
- return repr(self.value)
-
-
def get_path(path):
if "$" not in path:
return path
More information about the grass-commit
mailing list