def __init__(self, connectArgs):
        connectArgs = string.split(connectArgs, ':')
        host = None
        if connectArgs and connectArgs[0]:  #if host is there
            if '|' in connectArgs[0]:  #if specified port
                host = connectArgs[0].replace('|', ':')

        if connectArgs and connectArgs[-1] == 'verbose':
            self.verbose = 1
            connectArgs = connectArgs[:-1]
            #connectArgs = string.join(connectArgs[:-1], ':')
        else:
            #connectArgs = string.join(connectArgs, ':')
            self.verbose = 0
        if connectArgs and connectArgs[-1] == 'cache':
            self.useCacheMod = 1
            connectArgs = string.join(connectArgs[:-1], ':')
        else:
            connectArgs = string.join(connectArgs, ':')
            self.useCacheMod = 0

        self.connectArgs = connectArgs
        if self.useCacheMod:
            import PostgreSql
            self.conn = PostgreSql.getConnection(connectArgs)
        else:
            if host is not None:
                self.conn = pgdb.connect(connectArgs, host=host)
            else:
                self.conn = pgdb.connect(connectArgs)
        self.bindVariables = 0
 def __init__(self, connectArgs):
     connectArgs = string.split(connectArgs,':')
     host = None
     if connectArgs and connectArgs[0]: #if host is there
         if '|' in connectArgs[0]: #if specified port
             host = connectArgs[0].replace('|', ':')
             
     if connectArgs and connectArgs[-1] == 'verbose':
         self.verbose = 1
         connectArgs = connectArgs[:-1]
         #connectArgs = string.join(connectArgs[:-1], ':')
     else:
         #connectArgs = string.join(connectArgs, ':')
         self.verbose=0
     if connectArgs and connectArgs[-1] == 'cache':
         self.useCacheMod = 1
         connectArgs = string.join(connectArgs[:-1], ':')
     else:
         connectArgs = string.join(connectArgs, ':')
         self.useCacheMod =0
     
     self.connectArgs = connectArgs
     if self.useCacheMod:
         import PostgreSql
         self.conn = PostgreSql.getConnection(connectArgs)
     else:
         if host is not None:
             self.conn = pgdb.connect(connectArgs, host = host)
         else:
             self.conn = pgdb.connect(connectArgs)
     self.bindVariables = 0
#
#  Copyright (C) 2001 Andrew T. Csillag <*****@*****.**>
#
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#
from SkunkWeb import Configuration
import PostgreSql

Configuration.mergeDefaults(PostgreSQLConnectParams={})

for u, p in Configuration.PostgreSQLConnectParams.items():
    PostgreSql.initUser(u, p)


def rollback(*args):
    for v in PostgreSql._connections.values():
        v.rollback()


from requestHandler.requestHandler import CleanupRequest

CleanupRequest.addFunction(rollback)
Exemple #4
0
#  
#  Copyright (C) 2001 Andrew T. Csillag <*****@*****.**>
#  
#      You may distribute under the terms of either the GNU General
#      Public License or the SkunkWeb License, as specified in the
#      README file.
#   
from SkunkWeb import Configuration
import PostgreSql

Configuration.mergeDefaults(
    PostgreSQLConnectParams = {},
    )

for u, p in Configuration.PostgreSQLConnectParams.items():
    PostgreSql.initUser ( u, p )

def rollback(*args):
    for v in PostgreSql._connections.values():
        v.rollback()

from requestHandler.requestHandler import CleanupRequest
CleanupRequest.addFunction(rollback)