def check_precondition(f):
    '\n        Works as a decorator.\n        Checks database connection status.\n        Attach connection object and template path.\n        '

    @wraps(f)
    def wrap(*args, **kwargs):
        self = args[0]
        driver = get_driver(PG_DEFAULT_DRIVER)
        self.manager = driver.connection_manager(kwargs['sid'])
        self.conn = self.manager.connection(did=kwargs['did'])
        self.qtIdent = driver.qtIdent
        self.template_path = 'check_constraint/sql/#{0}#'.format(self.manager.version)
        SQL = render_template('/'.join([self.template_path, 'get_parent.sql']), tid=kwargs['tid'])
        (status, rset) = self.conn.execute_2darray(SQL)
        if (not status):
            return internal_server_error(errormsg=rset)
        self.schema = rset['rows'][0]['schema']
        self.table = rset['rows'][0]['table']
        return f(*args, **kwargs)
    return wrap
Works as a decorator.
Checks database connection status.
Attach connection object and template path.
def check_precondition(f):
    '\n        Works as a decorator.\n        Checks database connection status.\n        Attach connection object and template path.\n        '

    @wraps(f)
    def wrap(*args, **kwargs):
        self = args[0]
        driver = get_driver(PG_DEFAULT_DRIVER)
        self.manager = driver.connection_manager(kwargs['sid'])
        self.conn = self.manager.connection(did=kwargs['did'])
        self.qtIdent = driver.qtIdent
        self.template_path = 'check_constraint/sql/#{0}#'.format(self.manager.version)
        SQL = render_template('/'.join([self.template_path, 'get_parent.sql']), tid=kwargs['tid'])
        (status, rset) = self.conn.execute_2darray(SQL)
        if (not status):
            return internal_server_error(errormsg=rset)
        self.schema = rset['rows'][0]['schema']
        self.table = rset['rows'][0]['table']
        return f(*args, **kwargs)
    return wrap