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