X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/81704cba7ed4c564f21f30e2c12bf08b089ffee8..2591b1770a0d108069a8b1ffee485ae02f796263:/forum_modules/pgfulltext/startup.py diff --git a/forum_modules/pgfulltext/startup.py b/forum_modules/pgfulltext/startup.py index 32a7992..0eb3f39 100644 --- a/forum_modules/pgfulltext/startup.py +++ b/forum_modules/pgfulltext/startup.py @@ -1,21 +1,11 @@ import os from forum.models import KeyValue from django.db import connection, transaction +import settings -KEY = 'PG_FTSTRIGGERS_VERSION' -VERSION = 3 -install = False +VERSION = 6 -try: - version = KeyValue.objects.get(key=KEY).value - if version < VERSION: - install = True -except: - install = True - - -if install: - print 'install' +if int(settings.PG_FTSTRIGGERS_VERSION) < VERSION: f = open(os.path.join(os.path.dirname(__file__), 'pg_fts_install.sql'), 'r') try: @@ -23,19 +13,15 @@ if install: cursor.execute(f.read()) transaction.commit_unless_managed() - try: - kv = KeyValue.objects.get(key=KEY) - except: - kv = KeyValue(key=KEY) - - kv.value = VERSION - kv.save() + settings.PG_FTSTRIGGERS_VERSION.set_value(VERSION) except Exception, e: - import sys, traceback - traceback.print_exc(file=sys.stdout) + #import sys, traceback + #traceback.print_exc(file=sys.stdout) pass finally: cursor.close() f.close() + +import handlers