always ignore postgresql settings if support is disabled

This commit is contained in:
Frédéric Péters 2012-08-13 10:17:53 +02:00
parent 1ed314d150
commit 03d0efa0e3
2 changed files with 3 additions and 3 deletions

View File

@ -140,7 +140,7 @@ class FormDef(StorableObject):
def data_class(self):
if hasattr(sys.modules['formdef'], self.url_name.title()):
return getattr(sys.modules['formdef'], self.url_name.title())
if get_cfg('postgresql', {}):
if get_publisher().has_site_option('postgresql') and get_cfg('postgresql', {}):
table_name = 'formdata_' + self.url_name.replace('-', '_')
cls = new.classobj(self.url_name.title(), (sql.SqlFormData,),
{'_formdef': self,
@ -156,7 +156,7 @@ class FormDef(StorableObject):
new_url_name = simplify(self.name)
if not self.url_name:
self.url_name = new_url_name
if get_cfg('postgresql', {}):
if get_publisher().has_site_option('postgresql') and get_cfg('postgresql', {}):
sql.do_formdef_tables(self)
elif new_url_name != self.url_name:
# title changed, url will be changed only if there are not yet any

View File

@ -128,7 +128,7 @@ class WcsPublisher(StubWcsPublisher):
import wcs.workflows
wcs.workflows.load_extra()
if get_cfg('postgresql', {}):
if self.has_site_option('postgresql') and get_cfg('postgresql', {}):
import sql
self.user_class = sql.SqlUser
else: