[GRASS-dev] [GRASS-SVN] r66014 - grass/trunk/lib/python/temporal
Sören Gebbert
soerengebbert at googlemail.com
Sat Sep 5 11:58:04 PDT 2015
Hi Markus,
looks good to me.
Ciao
Soeren
2015-09-05 18:39 GMT+02:00 Markus Neteler <neteler at osgeo.org>:
> Hi Soeren,
>
> ich habe versucht, den relevanten Teil Deines fixes zu backporten:
>
> https://trac.osgeo.org/grass/changeset/66115
>
> Ich hoffe, dass es richtig ist..
>
> Gruesse
> Markus
>
> On Tue, Aug 25, 2015 at 12:13 PM, <svn_grass at osgeo.org> wrote:
>> Author: huhabla
>> Date: 2015-08-25 03:13:30 -0700 (Tue, 25 Aug 2015)
>> New Revision: 66014
>>
>> Modified:
>> grass/trunk/lib/python/temporal/c_libraries_interface.py
>> grass/trunk/lib/python/temporal/core.py
>> grass/trunk/lib/python/temporal/space_time_datasets.py
>> Log:
>> temporal library: Fixed wrong mapset access method
>>
>>
>> Modified: grass/trunk/lib/python/temporal/c_libraries_interface.py
>> ===================================================================
>> --- grass/trunk/lib/python/temporal/c_libraries_interface.py 2015-08-25 10:03:10 UTC (rev 66013)
>> +++ grass/trunk/lib/python/temporal/c_libraries_interface.py 2015-08-25 10:13:30 UTC (rev 66014)
>> @@ -151,15 +151,17 @@
>>
>> :returns: Names of available mapsets as list of strings
>> """
>> -
>> +
>> count = 0
>> mapset_list = []
>> try:
>> + # Initilaize the accessable mapset list, this is bad C design!!!
>> + libgis.G_get_mapset_name(0)
>> mapsets = libgis.G_get_available_mapsets()
>> while mapsets[count]:
>> char_list = ""
>> mapset = mapsets[count]
>> - if libgis.G_mapset_permissions(mapset) > 0:
>> + if libgis.G_mapset_permissions(mapset) == 1 and libgis.G_is_mapset_in_search_path(mapset) == 1:
>> c = 0
>> while mapset[c] != "\x00":
>> char_list += mapset[c]
>> @@ -758,7 +760,7 @@
>> CALLBACK.argtypes = c_void_p
>>
>> cerror_handler = CALLBACK(error_handler)
>> -
>> +
>> libgis.G_add_error_handler(cerror_handler, None)
>>
>> # Crerate the function array
>> @@ -914,17 +916,17 @@
>> >>> mapset = ciface.get_mapset()
>> >>> location = ciface.get_location()
>> >>> gisdbase = ciface.get_gisdbase()
>> -
>> +
>> >>> ciface.fatal_error()
>> Traceback (most recent call last):
>> raise FatalError(message)
>> FatalError: Fatal error
>> -
>> +
>> >>> ciface.fatal_error()
>> Traceback (most recent call last):
>> raise FatalError(message)
>> FatalError: Fatal error
>> -
>> +
>> >>> ciface.fatal_error()
>> Traceback (most recent call last):
>> raise FatalError(message)
>> @@ -950,7 +952,7 @@
>> self.start_server()
>> self.start_checker_thread()
>> self.stopThread = False
>> -
>> +
>> def start_checker_thread(self):
>> if self.checkThread is not None and self.checkThread.is_alive():
>> self.stop_checker_thread()
>> @@ -959,13 +961,13 @@
>> self.checkThread.daemon = True
>> self.stopThread = False
>> self.checkThread.start()
>> -
>> +
>> def stop_checker_thread(self):
>> self.threadLock.acquire()
>> self.stopThread = True
>> self.threadLock.release()
>> self.checkThread.join(None)
>> -
>> +
>> def thread_checker(self):
>> """Check every 200 micro seconds if the server process is alive"""
>> while True:
>> @@ -989,7 +991,7 @@
>>
>> def check_server(self):
>> self._check_restart_server()
>> -
>> +
>> def _check_restart_server(self):
>> """Restart the server if it was terminated
>> """
>> @@ -1351,7 +1353,7 @@
>>
>> def fatal_error(self, mapset=None):
>> """Generate a fatal error in libgis.
>> -
>> +
>> This function is only for testing purpose.
>> """
>> self.check_server()
>> @@ -1360,7 +1362,7 @@
>> return self.safe_receive("Fatal error")
>>
>> def safe_receive(self, message):
>> - """Receive the data and throw an FatalError exception in case the server
>> + """Receive the data and throw an FatalError exception in case the server
>> process was killed and the pipe was closed by the checker thread"""
>> try:
>> ret = self.client_conn.recv()
>>
>> Modified: grass/trunk/lib/python/temporal/core.py
>> ===================================================================
>> --- grass/trunk/lib/python/temporal/core.py 2015-08-25 10:03:10 UTC (rev 66013)
>> +++ grass/trunk/lib/python/temporal/core.py 2015-08-25 10:13:30 UTC (rev 66014)
>> @@ -750,7 +750,7 @@
>> stvds_tables_sql = stds_tables_template_sql.replace("STDS", "stvds")
>> str3ds_tables_sql = stds_tables_template_sql.replace("STDS", "str3ds")
>>
>> - msgr.message(_("Creating temporal database: %s" % (tgis_database_string)))
>> + msgr.message(_("Creating temporal database: %s" % (str(tgis_database_string))))
>>
>> if tgis_backend == "sqlite":
>> # We need to create the sqlite3 database path if it does not exists
>> @@ -860,7 +860,7 @@
>> driver, dbstring = self.tgis_mapsets[mapset]
>>
>> if dbstring not in self.unique_connections.keys():
>> - self.unique_connections[dbstring] = DBConnection(backend=driver,
>> + self.unique_connections[dbstring] = DBConnection(backend=driver,
>> dbstring=dbstring)
>>
>> self.connections[mapset] = self.unique_connections[dbstring]
>> @@ -1025,7 +1025,7 @@
>>
>> def __init__(self, backend=None, dbstring=None):
>> """ Constructor of a database connection
>> -
>> +
>> param backend:The database backend sqlite or pg
>> param dbstring: The database connection string
>> """
>> @@ -1071,7 +1071,7 @@
>> """Connect to the DBMI to execute SQL statements
>>
>> Supported backends are sqlite3 and postgresql
>> -
>> +
>> param dbstring: The database connection string
>> """
>> # Connection in the current mapset
>>
>> Modified: grass/trunk/lib/python/temporal/space_time_datasets.py
>> ===================================================================
>> --- grass/trunk/lib/python/temporal/space_time_datasets.py 2015-08-25 10:03:10 UTC (rev 66013)
>> +++ grass/trunk/lib/python/temporal/space_time_datasets.py 2015-08-25 10:13:30 UTC (rev 66014)
>> @@ -88,7 +88,7 @@
>> >>> rmap.get_temporal_extent_as_tuple()
>> (datetime.datetime(2001, 1, 1, 0, 0), datetime.datetime(2012, 1, 1, 0, 0))
>> >>> rmap.get_name()
>> - 'strds_map_test_case'
>> + u'strds_map_test_case'
>> >>> rmap.get_mapset() == mapset
>> True
>> >>> rmap.get_temporal_type()
>> @@ -407,7 +407,7 @@
>> >>> r3map.get_temporal_extent_as_tuple()
>> (datetime.datetime(2001, 1, 1, 0, 0), datetime.datetime(2012, 1, 1, 0, 0))
>> >>> r3map.get_name()
>> - 'str3ds_map_test_case'
>> + u'str3ds_map_test_case'
>> >>> r3map.get_mapset() == mapset
>> True
>> >>> r3map.get_temporal_type()
>> @@ -737,7 +737,7 @@
>> >>> vmap.get_temporal_extent_as_tuple()
>> (datetime.datetime(2001, 1, 1, 0, 0), datetime.datetime(2012, 1, 1, 0, 0))
>> >>> vmap.get_name()
>> - 'stvds_map_test_case'
>> + u'stvds_map_test_case'
>> >>> vmap.get_mapset() == mapset
>> True
>> >>> vmap.get_temporal_type()
>>
>> _______________________________________________
>> grass-commit mailing list
>> grass-commit at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/grass-commit
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
More information about the grass-dev
mailing list