Skip to content
Permalink
Browse files
dbmanager: fix #5812,
move PG informations to postgis/info_model.py
  • Loading branch information
brushtyler committed Nov 29, 2012
1 parent 563cce9 commit 3542b0897dae56796d2d2e231e65166cd50be283
@@ -56,23 +56,14 @@ def spatialInfo(self):

tbl = [
("Library:", info[0]),
("Scripts:", info[1]),
("GEOS:", info[3]),
("Proj:", info[4]),
("Use stats:", info[5])
("GEOS:", info[1]),
("Proj:", info[2])
]
ret.append( HtmlTable( tbl ) )

if info[1] != None and info[1] != info[2]:
ret.append( HtmlParagraph( u"<warning> Version of installed scripts doesn't match version of released scripts!\n" \
"This is probably a result of incorrect PostGIS upgrade." ) )

if not self.db.connector.has_geometry_columns:
ret.append( HtmlParagraph( u"<warning> geometry_columns table doesn't exist!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
elif not self.db.connector.has_geometry_columns_access:
ret.append( HtmlParagraph( u"<warning> This user doesn't have privileges to read contents of geometry_columns table!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )

return ret

@@ -115,18 +115,17 @@ def getInfo(self):
def getSpatialInfo(self):
""" returns tuple about postgis support:
- lib version
- installed scripts version
- released scripts version
- geos version
- proj version
- whether uses stats
- installed scripts version
- released scripts version
"""
if not self.has_spatial:
return

c = self._get_cursor()
try:
self._execute(c, u"SELECT postgis_lib_version(), postgis_scripts_installed(), postgis_scripts_released(), postgis_geos_version(), postgis_proj_version(), postgis_uses_stats()")
self._execute(c, u"SELECT postgis_lib_version(), postgis_geos_version(), postgis_proj_version(), postgis_scripts_installed(), postgis_scripts_released()")
except DbError:
return

@@ -97,6 +97,34 @@ def generalInfo(self):

return ret

def getSpatialInfo(self):
ret = []

info = self.db.connector.getSpatialInfo()
if info == None:
return

tbl = [
("Library:", info[0]),
("Scripts:", info[3]),
("GEOS:", info[1]),
("Proj:", info[2])
]
ret.append( HtmlTable( tbl ) )

if info[1] != None and info[1] != info[2]:
ret.append( HtmlParagraph( u"<warning> Version of installed scripts doesn't match version of released scripts!\n" \
"This is probably a result of incorrect PostGIS upgrade." ) )

if not self.db.connector.has_geometry_columns:
ret.append( HtmlParagraph( u"<warning> geometry_columns table doesn't exist!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )
elif not self.db.connector.has_geometry_columns_access:
ret.append( HtmlParagraph( u"<warning> This user doesn't have privileges to read contents of geometry_columns table!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )

return ret


def fieldsDetails(self):
tbl = []
@@ -36,26 +36,6 @@ def connectionDetails(self):
]
return HtmlTable( tbl )

def spatialInfo(self):
ret = []

info = self.db.connector.getSpatialInfo()
if info == None:
return

tbl = [
("Library:", info[0]),
("GEOS:", info[1]),
("Proj:", info[2])
]
ret.append( HtmlTable( tbl ) )

if not self.db.connector.has_geometry_columns:
ret.append( HtmlParagraph( u"<warning> geometry_columns table doesn't exist!\n" \
"This table is essential for many GIS applications for enumeration of tables." ) )

return ret

def generalInfo(self):
info = self.db.connector.getInfo()
tbl = [

0 comments on commit 3542b08

Please sign in to comment.