Explorar o código

Fix history line and length methods

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@59191 15284696-431f-4ddb-bdfa-cd5b030d7da7
Pietro Zambelli %!s(int64=11) %!d(string=hai) anos
pai
achega
568f773825
Modificáronse 1 ficheiros con 6 adicións e 3 borrados
  1. 6 3
      lib/python/pygrass/raster/history.py

+ 6 - 3
lib/python/pygrass/raster/history.py

@@ -62,6 +62,9 @@ class History(object):
         """Rast_free_history"""
         pass
 
+    def __len__(self):
+        return self.length()
+
     #----------------------------------------------------------------------
     #libraster.HIST_CREATOR
     def _get_creator(self):
@@ -213,12 +216,12 @@ class History(object):
 
     def length(self):
         """Rast_history_length"""
-        libraster.Rast_history_length(self.c_hist)
+        return libraster.Rast_history_length(self.c_hist)
 
     def line(self, line):
         """Rast_history_line"""
-        libraster.Rast_history_line(self.c_hist,
-                                    ctypes.c_int(line))
+        return libraster.Rast_history_line(self.c_hist,
+                                           ctypes.c_int(line))
 
     def read(self):
         """Rast_read_history. ::