diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-02-22 22:08:15 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-02-22 22:08:15 -0500 |
commit | 2390d0191c52ae585cda3f1ae6f884cc58639025 (patch) | |
tree | db8fa64e6161e709297997db7986db949ac2500e /forum_modules/pgfulltext/management.py | |
parent | a00d0c172d129986509943218e4c44dc3c40aff4 (diff) | |
parent | a5b2133fa2b8ab205d87fcdc2dd1d6335d37ea3c (diff) | |
download | askbot-2390d0191c52ae585cda3f1ae6f884cc58639025.tar.gz askbot-2390d0191c52ae585cda3f1ae6f884cc58639025.tar.bz2 askbot-2390d0191c52ae585cda3f1ae6f884cc58639025.zip |
merged adolfos branch, dos2unixd everything
Diffstat (limited to 'forum_modules/pgfulltext/management.py')
-rwxr-xr-x | forum_modules/pgfulltext/management.py | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/forum_modules/pgfulltext/management.py b/forum_modules/pgfulltext/management.py index 89eb1395..487580ff 100755 --- a/forum_modules/pgfulltext/management.py +++ b/forum_modules/pgfulltext/management.py @@ -1,29 +1,29 @@ -import os
-
-from django.db import connection, transaction
-from django.conf import settings
-
-import forum.models
-
-if settings.DATABASE_ENGINE in ('postgresql_psycopg2', 'postgresql', ):
- from django.db.models.signals import post_syncdb
-
- def setup_pgfulltext(sender, **kwargs):
- if sender == forum.models:
- install_pg_fts()
-
- post_syncdb.connect(setup_pgfulltext)
-
-def install_pg_fts():
- f = open(os.path.join(os.path.dirname(__file__), 'pg_fts_install.sql'), 'r')
-
- try:
- cursor = connection.cursor()
- cursor.execute(f.read())
- transaction.commit_unless_managed()
- except:
- pass
- finally:
- cursor.close()
-
- f.close()
+import os + +from django.db import connection, transaction +from django.conf import settings + +import forum.models + +if settings.DATABASE_ENGINE in ('postgresql_psycopg2', 'postgresql', ): + from django.db.models.signals import post_syncdb + + def setup_pgfulltext(sender, **kwargs): + if sender == forum.models: + install_pg_fts() + + post_syncdb.connect(setup_pgfulltext) + +def install_pg_fts(): + f = open(os.path.join(os.path.dirname(__file__), 'pg_fts_install.sql'), 'r') + + try: + cursor = connection.cursor() + cursor.execute(f.read()) + transaction.commit_unless_managed() + except: + pass + finally: + cursor.close() + + f.close() |