]> git.openstreetmap.org Git - osqa.git/blob - forum_modules/pgfulltext/startup.py
OSQA-382, convert the python files line endings to OS native mode, propedit svn:eol...
[osqa.git] / forum_modules / pgfulltext / startup.py
1 import os
2 from forum.models import KeyValue
3 from django.db import connection, transaction
4 import settings
5
6 VERSION = 11
7
8 if int(settings.PG_FTSTRIGGERS_VERSION) < VERSION:
9     f = open(os.path.join(os.path.dirname(__file__), 'pg_fts_install.sql'), 'r')
10
11     try:
12         cursor = connection.cursor()
13         cursor.execute(f.read())
14         transaction.commit_unless_managed()
15
16         settings.PG_FTSTRIGGERS_VERSION.set_value(VERSION)
17         
18     except Exception, e:
19         #import sys, traceback
20         #traceback.print_exc(file=sys.stdout)
21         pass
22     finally:
23         cursor.close()
24
25     f.close()
26
27 import handlers