Exemple #1
0
    def _from_connection(conn):
        ds = datasource(None)
        
        ds._conn = conn
        ds._update_cursor = ds._conn.cursor()

        return ds
Exemple #2
0
    def _from_connection(conn):
        ds = datasource(None)

        ds._conn = conn
        ds._update_cursor = ds._conn.cursor()

        return ds
Exemple #3
0
    def _from_params(kw):
        if kw.has_key("db"):
            kw["database"] = kw["db"]
            del kw["db"]

        self = datasource(**kw)

        if kw.has_key("charset"):
            encoding = kw["charset"]
            self._backend_encoding = self.encodings.get(encoding, "ascii")
        else:
            self._backend_encoding = "iso-8859-1" # probably the most common

        return self
Exemple #4
0
    def _from_params(kw):
        if kw.has_key("db"):
            kw["database"] = kw["db"]
            del kw["db"]

        self = datasource(**kw)

        if kw.has_key("charset"):
            encoding = kw["charset"]
            self._backend_encoding = self.encodings.get(encoding, "ascii")
        else:
            self._backend_encoding = "iso-8859-1" # probably the most common

        return self
Exemple #5
0
    def _from_params(params):
        """
        A pgsql connection string may contain all the standard ORM keywords
        plus all of those described above in the __init__ method's
        doc 
        """
        if params.has_key("db"):
            dbname = params["db"]
            del params["db"]
            params["dbname"] = dbname

        dsn = []
        for a in params.items():
            dsn.append("%s=%s" % a)

        return datasource(join(dsn, " "))
Exemple #6
0
    def _from_params(params):
        """
        A pgsql connection string may contain all the standard ORM keywords
        plus all of those described above in the __init__ method's
        doc 
        """
        if params.has_key("db"):
            dbname = params["db"]
            del params["db"]
            params["dbname"] = dbname

        dsn = []
        for a in params.items():
            dsn.append("%s=%s" % a)

        return datasource(join(dsn, " "))
Exemple #7
0
    def _from_params(params):
        """
        Construct a mysql datasource object from an orm connection
        string. 
        
        A connection string for the mysql adapter may contain all
        keywords defined in orm2.datasource plus all those that are
        described as keyword parameters for __init__ above.        
        """
        
        if params.has_key("password"):
            passwd = params["password"]
            del params["password"]
            params["passwd"] = passwd

        if params.has_key("dbname"):
            dbname = params["dbname"]
            del params["dbname"]
            params["db"] = dbname

        return datasource(**params)
Exemple #8
0
    def _from_params(params):
        """
        Construct a mysql datasource object from an orm connection
        string. 
        
        A connection string for the mysql adapter may contain all
        keywords defined in orm2.datasource plus all those that are
        described as keyword parameters for __init__ above.        
        """

        if params.has_key("password"):
            passwd = params["password"]
            del params["password"]
            params["passwd"] = passwd

        if params.has_key("dbname"):
            dbname = params["dbname"]
            del params["dbname"]
            params["db"] = dbname

        return datasource(**params)
Exemple #9
0
    def _from_params(params):
        database_name = params.get("dbname", "tmp")
        database_directory = params.get("directory", "/tmp")
        encoding = params.get("encoding", "iso-8859-1")

        return datasource(database_name, database_directory, encoding)
Exemple #10
0
    def _from_params(params):
        database_name = params.get("dbname", "tmp")
        database_directory = params.get("directory", "/tmp")
        encoding = params.get("encoding", "iso-8859-1")

        return datasource(database_name, database_directory, encoding)