Browse Source

Fix: Change write attribute into writable, to not overwrite the write method

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54329 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli 12 years ago
parent
commit
ec240ecb8a

+ 2 - 2
lib/python/pygrass/vector/__init__.py

@@ -315,7 +315,7 @@ class VectorTopo(Vector):
             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 @@ class VectorTopo(Vector):
             if v != 0:
                 output = False
                 break
-        return output        
+        return output
 
     @must_be_open
     def rewrite(self, geo_obj):

+ 1 - 1
lib/python/pygrass/vector/abstract.py

@@ -262,7 +262,7 @@ class Info(object):
             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:

+ 5 - 5
lib/python/pygrass/vector/geometry.py

@@ -112,11 +112,11 @@ def get_xyz(pnt):
 
 
 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 @@ class Attrs(object):
             >>> 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 @@ class Geo(object):
     >>> 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 @@ class Geo(object):
 
         # 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: