| OLD | NEW |
| 1 # Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/ | 1 # Copyright (c) 2006,2007,2008 Mitch Garnaat http://garnaat.org/ |
| 2 # | 2 # |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | 3 # Permission is hereby granted, free of charge, to any person obtaining a |
| 4 # copy of this software and associated documentation files (the | 4 # copy of this software and associated documentation files (the |
| 5 # "Software"), to deal in the Software without restriction, including | 5 # "Software"), to deal in the Software without restriction, including |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | 6 # without limitation the rights to use, copy, modify, merge, publish, dis- |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | 7 # tribute, sublicense, and/or sell copies of the Software, and to permit |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | 8 # persons to whom the Software is furnished to do so, subject to the fol- |
| 9 # lowing conditions: | 9 # lowing conditions: |
| 10 # | 10 # |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if boto.config.has_section(db_section): | 59 if boto.config.has_section(db_section): |
| 60 db_user = boto.config.get(db_section, 'db_user', db_user) | 60 db_user = boto.config.get(db_section, 'db_user', db_user) |
| 61 db_passwd = boto.config.get(db_section, 'db_passwd', db_passwd) | 61 db_passwd = boto.config.get(db_section, 'db_passwd', db_passwd) |
| 62 db_type = boto.config.get(db_section, 'db_type', db_type) | 62 db_type = boto.config.get(db_section, 'db_type', db_type) |
| 63 db_name = boto.config.get(db_section, 'db_name', db_name) | 63 db_name = boto.config.get(db_section, 'db_name', db_name) |
| 64 db_table = boto.config.get(db_section, 'db_table', db_table) | 64 db_table = boto.config.get(db_section, 'db_table', db_table) |
| 65 db_host = boto.config.get(db_section, 'db_host', db_host) | 65 db_host = boto.config.get(db_section, 'db_host', db_host) |
| 66 db_port = boto.config.getint(db_section, 'db_port', db_port) | 66 db_port = boto.config.getint(db_section, 'db_port', db_port) |
| 67 enable_ssl = boto.config.getint(db_section, 'enable_ssl', enable_ssl) | 67 enable_ssl = boto.config.getint(db_section, 'enable_ssl', enable_ssl) |
| 68 debug = boto.config.getint(db_section, 'debug', debug) | 68 debug = boto.config.getint(db_section, 'debug', debug) |
| 69 elif hasattr(cls, "_db_name") and cls._db_name is not None: |
| 70 # More specific then the generic DB config is any _db_name class propert
y |
| 71 db_name = cls._db_name |
| 69 elif hasattr(cls.__bases__[0], "_manager"): | 72 elif hasattr(cls.__bases__[0], "_manager"): |
| 70 return cls.__bases__[0]._manager | 73 return cls.__bases__[0]._manager |
| 71 if db_type == 'SimpleDB': | 74 if db_type == 'SimpleDB': |
| 72 from sdbmanager import SDBManager | 75 from sdbmanager import SDBManager |
| 73 return SDBManager(cls, db_name, db_user, db_passwd, | 76 return SDBManager(cls, db_name, db_user, db_passwd, |
| 74 db_host, db_port, db_table, sql_dir, enable_ssl) | 77 db_host, db_port, db_table, sql_dir, enable_ssl) |
| 75 elif db_type == 'PostgreSQL': | 78 elif db_type == 'PostgreSQL': |
| 76 from pgmanager import PGManager | 79 from pgmanager import PGManager |
| 77 if db_table: | 80 if db_table: |
| 78 return PGManager(cls, db_name, db_user, db_passwd, | 81 return PGManager(cls, db_name, db_user, db_passwd, |
| 79 db_host, db_port, db_table, sql_dir, enable_ssl) | 82 db_host, db_port, db_table, sql_dir, enable_ssl) |
| 80 else: | 83 else: |
| 81 return None | 84 return None |
| 82 elif db_type == 'XML': | 85 elif db_type == 'XML': |
| 83 from xmlmanager import XMLManager | 86 from xmlmanager import XMLManager |
| 84 return XMLManager(cls, db_name, db_user, db_passwd, | 87 return XMLManager(cls, db_name, db_user, db_passwd, |
| 85 db_host, db_port, db_table, sql_dir, enable_ssl) | 88 db_host, db_port, db_table, sql_dir, enable_ssl) |
| 86 else: | 89 else: |
| 87 raise ValueError, 'Unknown db_type: %s' % db_type | 90 raise ValueError, 'Unknown db_type: %s' % db_type |
| 88 | 91 |
| OLD | NEW |