diff options
author | Nate Case <ncase@xes-inc.com> | 2008-08-22 15:58:05 -0500 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2008-08-23 11:04:35 +0800 |
commit | 7451e16588d2de6bce18fcc60b3be654ee591ac1 (patch) | |
tree | d1bb37c8877ab7f6f38c8b053fcbe29adf288119 /apps | |
parent | 05d26756d7e7f254d5631a0649aeac5fd3a58ca8 (diff) | |
download | patchwork-7451e16588d2de6bce18fcc60b3be654ee591ac1.tar.bz2 patchwork-7451e16588d2de6bce18fcc60b3be654ee591ac1.tar.xz |
Support postgresql_psycopg2 DATABASE_ENGINE
Check for "postgresql*" rather than just "postgresql" in
HashField.db_type() so that postgresql_psycopg2 will work.
While we're here, raise an exception if the database engine is
unknown rather than silently not returning anything.
Signed-off-by: Nate Case <ncase@xes-inc.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/patchwork/models.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/patchwork/models.py b/apps/patchwork/models.py index 6d331f3..11457d7 100644 --- a/apps/patchwork/models.py +++ b/apps/patchwork/models.py @@ -194,10 +194,13 @@ class HashField(models.Field): n_bytes = len(hashlib.new(self.algorithm).digest()) else: n_bytes = len(self.hash_constructor().digest()) - if settings.DATABASE_ENGINE == 'postgresql': + if settings.DATABASE_ENGINE.startswith('postgresql'): return 'bytea' elif settings.DATABASE_ENGINE == 'mysql': return 'binary(%d)' % n_bytes + else: + raise Exception("Unknown database engine '%s'" % \ + settings.DATABASE_ENGINE) def to_python(self, value): return value |