예제 #1
0
파일: decorators.py 프로젝트: jzitnik/z-pim
    def wrapped(self, *args):
        for name, value in zip(arg_names[1:], args):
            setattr(self, name, value)

        conn = Service.getPostgresPool().getconn()
        cursor = conn.cursor()
        cursor.execute("BEGIN")
        #self.cursor = cursor

        try:
            return function(self, cursor, *args)
            cursor.execute("COMMIT")

        except Exception, e:
            cursor.execute("ROLLBACK")
            print e

            traceback.print_exc(file=sys.stdout)
예제 #2
0
파일: decorators.py 프로젝트: jzitnik/z-pim
    def wrapped(self, *args):
        for name, value in zip(arg_names[1:], args):
            setattr(self, name, value)

        conn = Service.getPostgresPool().getconn()
        cursor = conn.cursor()
        cursor.execute("BEGIN")
        # self.cursor = cursor

        try:
            return function(self, cursor, *args)
            cursor.execute("COMMIT")

        except Exception, e:
            cursor.execute("ROLLBACK")
            print e

            traceback.print_exc(file=sys.stdout)
예제 #3
0
파일: decorators.py 프로젝트: jzitnik/z-pim
import sys


def SQLTransaction(function):

    arg_names = inspect.getargspec(function)[0]

    def wrapped(self, *args):
        for name, value in zip(arg_names[1:], args):
            setattr(self, name, value)

        conn = Service.getPostgresPool().getconn()
        cursor = conn.cursor()
        cursor.execute("BEGIN")
        #self.cursor = cursor

        try:
            return function(self, cursor, *args)
            cursor.execute("COMMIT")

        except Exception, e:
            cursor.execute("ROLLBACK")
            print e

            traceback.print_exc(file=sys.stdout)

        finally:
            Service.getPostgresPool().putconn(conn)

    return wrapped
예제 #4
0
파일: decorators.py 프로젝트: jzitnik/z-pim
import sys


def SQLTransaction(function):

    arg_names = inspect.getargspec(function)[0]

    def wrapped(self, *args):
        for name, value in zip(arg_names[1:], args):
            setattr(self, name, value)

        conn = Service.getPostgresPool().getconn()
        cursor = conn.cursor()
        cursor.execute("BEGIN")
        # self.cursor = cursor

        try:
            return function(self, cursor, *args)
            cursor.execute("COMMIT")

        except Exception, e:
            cursor.execute("ROLLBACK")
            print e

            traceback.print_exc(file=sys.stdout)

        finally:
            Service.getPostgresPool().putconn(conn)

    return wrapped