[GRASS-SVN] r54329 - grass/trunk/lib/python/pygrass/vector

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 18 00:34:18 PST 2012


Author: zarch
Date: 2012-12-18 00:34:17 -0800 (Tue, 18 Dec 2012)
New Revision: 54329

Modified:
   grass/trunk/lib/python/pygrass/vector/__init__.py
   grass/trunk/lib/python/pygrass/vector/abstract.py
   grass/trunk/lib/python/pygrass/vector/geometry.py
Log:
Fix: Change write attribute into writable, to not overwrite the write method

Modified: grass/trunk/lib/python/pygrass/vector/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/__init__.py	2012-12-17 22:12:27 UTC (rev 54328)
+++ grass/trunk/lib/python/pygrass/vector/__init__.py	2012-12-18 08:34:17 UTC (rev 54329)
@@ -315,7 +315,7 @@
             if _GEOOBJ[vtype] is not None:
                 return (_GEOOBJ[vtype](v_id=indx, c_mapinfo=self.c_mapinfo,
                                        table=self.table,
-                                       write=self.write)
+                                       writable=self.write)
                         for indx in xrange(1, self.number_of(vtype) + 1))
         else:
             keys = "', '".join(sorted(_GEOOBJ.keys()))
@@ -400,7 +400,7 @@
             if v != 0:
                 output = False
                 break
-        return output        
+        return output
 
     @must_be_open
     def rewrite(self, geo_obj):

Modified: grass/trunk/lib/python/pygrass/vector/abstract.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/abstract.py	2012-12-17 22:12:27 UTC (rev 54328)
+++ grass/trunk/lib/python/pygrass/vector/abstract.py	2012-12-18 08:34:17 UTC (rev 54329)
@@ -262,7 +262,7 @@
             raise OpenError(str_err % openvect)
         # istantiate the table
         self.table = self.get_table(link_id=self.link_id)
-        self.write = self.mapset == functions.getenv("MAPSET")
+        self.writable = self.mapset == functions.getenv("MAPSET")
 
     def get_table(self, link_id=None, link_name=None,):
         if link_id is None and link_name is None and len(self.dblinks) == 0:

Modified: grass/trunk/lib/python/pygrass/vector/geometry.py
===================================================================
--- grass/trunk/lib/python/pygrass/vector/geometry.py	2012-12-17 22:12:27 UTC (rev 54328)
+++ grass/trunk/lib/python/pygrass/vector/geometry.py	2012-12-18 08:34:17 UTC (rev 54329)
@@ -112,11 +112,11 @@
 
 
 class Attrs(object):
-    def __init__(self, v_id, table, write=False):
+    def __init__(self, v_id, table, writable=False):
         self.id = v_id
         self.table = table
         self.cond = "%s=%d" % (self.table.key, self.id)
-        self.write = write
+        self.writable = writable
 
     def __getitem__(self, key):
         """Return the value stored in the attribute table. ::
@@ -139,7 +139,7 @@
             >>> attrs['LABEL'] = 'New Label'
 
         .."""
-        if self.write:
+        if self.writable:
             #UPDATE {tname} SET {new_col} = {old_col} WHERE {condition}
             self.table.execute(sql.UPDATE_WHERE.format(tname=self.table.name,
                                                        new_col=key,
@@ -183,7 +183,7 @@
     >>> geo1 = Geo(c_points=points, c_cats=cats)
     """
     def __init__(self, v_id=None, c_mapinfo=None, c_points=None, c_cats=None,
-                 table=None, write=False):
+                 table=None, writable=False):
         self.id = v_id  # vector id
         self.c_mapinfo = c_mapinfo
 
@@ -201,7 +201,7 @@
 
         # set the attributes
         if table:
-            self.attrs = Attrs(self.id, table, write)
+            self.attrs = Attrs(self.id, table, writable)
 
     def is_with_topology(self):
         if self.c_mapinfo is not None:



More information about the grass-commit mailing list