16 |
# write to the Free Software Foundation, Inc., 59 Temple Place |
# write to the Free Software Foundation, Inc., 59 Temple Place |
17 |
# - Suite 330, Boston, MA 02111-1307, USA. |
# - Suite 330, Boston, MA 02111-1307, USA. |
18 |
# |
# |
19 |
# Copyright 2000, 2001 Free Software Foundation |
# Copyright 2000-2003 Free Software Foundation |
20 |
# |
# |
21 |
# FILE: |
# FILE: |
22 |
# config/DBdriver.py |
# config/DBdriver.py |
79 |
|
|
80 |
# check if name already exists |
# check if name already exists |
81 |
if section in dataCon.sections(): |
if section in dataCon.sections(): |
82 |
raise Configfile_Error,"The section name you have provided for"+\ |
tmsg = _("The section name you have provided for this record already exists.") |
83 |
" this record already exists." |
raise Configfile_Error, tmsg |
84 |
|
|
85 |
# check if name is empty |
# check if name is empty |
86 |
if len(section)<1: |
if len(section)<1: |
87 |
raise Configfile_Error,"You have to provide a section name for"+\ |
tmsg = _("You have to provide a section name for this record!") |
88 |
" this record!" |
raise Configfile_Error, tmsg |
89 |
|
|
90 |
dataCon.add_section(section) |
dataCon.add_section(section) |
91 |
|
|
100 |
|
|
101 |
# check if name already exists |
# check if name already exists |
102 |
if newsection in dataCon.sections(): |
if newsection in dataCon.sections(): |
103 |
raise Configfile_Error,"The section name you have provided for"+\ |
tmsg = _("The section name you have provided for this record already exists.") |
104 |
" this record already exists." |
raise Configfile_Error, tmsg |
105 |
|
|
106 |
# check if name is empty |
# check if name is empty |
107 |
|
|
108 |
if len(newsection)<1: |
if len(newsection)<1: |
109 |
raise Configfile_Error,"You have to provide a section name for"+\ |
tmsg = _("You have to provide a section name for this record!") |
110 |
" this record!" |
raise Configfile_Error, tmsg |
111 |
|
|
112 |
# add new section |
# add new section |
113 |
dataCon.add_section(newsection) |
dataCon.add_section(newsection) |
275 |
file.close() |
file.close() |
276 |
|
|
277 |
except: |
except: |
278 |
raise GDataObjects.ConnectionError, "Error opening config file %s" % self._filename |
tmsg = _("Error opening config file %s") % self._filename |
279 |
|
raise GDataObjects.ConnectionError, tmsg |
280 |
|
|
281 |
|
|
282 |
self.triggerExtensions = TriggerExtensions(self._dataConnection) |
self.triggerExtensions = TriggerExtensions(self._dataConnection) |
298 |
masterRecordSet=None,sql=""): |
masterRecordSet=None,sql=""): |
299 |
|
|
300 |
if conditions!=None: |
if conditions!=None: |
301 |
raise GDataObjects.ConnectionError, "This database driver always shows"+\ |
tmsg = _("This database driver always shows all sections\ |
302 |
" all sections of a config file. You cannot execute querys on it." |
of a config file. You cannot execute querys on it.") |
303 |
|
raise GDataObjects.ConnectionError, tmsg |
304 |
result=[] |
result=[] |
305 |
for section in self._dataConnection.sections(): |
for section in self._dataConnection.sections(): |
306 |
record={"_section_name":section} |
record={"_section_name":section} |