Example #1
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, " "))
Example #2
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)
Example #3
0
 def _from_connection(conn):
     ds = datasource(None)        
     ds._conn = conn
     return ds