diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-07-16 16:55:11 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-07-16 16:55:11 +0000 |
| commit | 361be49fe7cd944606c71b772c9407a732848b60 (patch) | |
| tree | 4c5db1c74f0066ad404d2c5751a36559f23664a9 /django/core/db/backends/postgresql.py | |
| parent | 68baafc1100ceae5c8073975f8561e101a4ec1a4 (diff) | |
Changed postgresql DB backend so that it gives a helpful error message if people are using psycopg 2 instead of version 1
git-svn-id: http://code.djangoproject.com/svn/django/trunk@109 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/core/db/backends/postgresql.py')
| -rw-r--r-- | django/core/db/backends/postgresql.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/django/core/db/backends/postgresql.py b/django/core/db/backends/postgresql.py index b70f286d9d..b2bfc613e4 100644 --- a/django/core/db/backends/postgresql.py +++ b/django/core/db/backends/postgresql.py @@ -62,7 +62,10 @@ def get_last_insert_id(cursor, table_name, pk_name): # Register these custom typecasts, because Django expects dates/times to be # in Python's native (standard-library) datetime/time format, whereas psycopg # use mx.DateTime by default. -Database.register_type(Database.new_type((1082,), "DATE", typecasts.typecast_date)) +try: + Database.register_type(Database.new_type((1082,), "DATE", typecasts.typecast_date)) +except AttributeError: + raise Exception, "You appear to be using Psycopg version 2, which isn't supported yet, because it's still in beta. Use psycopg version 1 instead: http://initd.org/projects/psycopg1" Database.register_type(Database.new_type((1083,1266), "TIME", typecasts.typecast_time)) Database.register_type(Database.new_type((1114,1184), "TIMESTAMP", typecasts.typecast_timestamp)) Database.register_type(Database.new_type((16,), "BOOLEAN", typecasts.typecast_boolean)) |
