##############################################################################
#
# Copyright (c) 2003 Santi Camps Taltavull <scamps@users.sourceforge.net>
# All Rights Reserved.
#
# This Library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation; either version 2.1 of the
# License, or (at your option) any later version.
#
# This Library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this Library; see the file LICENSE. If not,
# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA. or visit http://www.gnu.org
#
##############################################################################
from Products.ZPoPyDA.PoPy_browser import addPoPyConnectionForm, PoPyConnectionBrowser
from zetadb_postgres import ZetadbPostgres
class ZetadbPopy(ZetadbPostgres, PoPyConnectionBrowser):
""" Support for ZPoPyDA database adapter """
def __init__(self, id, title, connection_string, connected=None, attempts=10, seconds=5):
"Initialize an instance of the Object"
PoPyConnectionBrowser.__init__(self, id, title, connection_string, connected, attempts, seconds)
self.zetdb_db_remember_version()
def connect (self, *args, **kw):
""" Opens the connection, but also remember some information about our database """
result = apply(PoPyConnectionBrowser.inheritedAttribute('connect'), (self, ) + args, **kw)
self.zetadb_db_load_catalog()
return result
def _pg_fk_separator(self):
return '\\000'
def addPoPyConnectionBrowser (self, id, title, connection_string, connected, attempts, seconds, REQUEST):
"Adds an instance to the current folder"
from Products.zetadb.zetadb_popy import ZetadbPopy
self._setObject(id, ZetadbPopy(id, title, connection_string, connected, attempts, seconds))
if REQUEST is not None:
REQUEST.RESPONSE.redirect(REQUEST.URL1 + '/manage_main')