diff --git a/tests/runtests.py b/tests/runtests.py index 55d746d..ac7fbcb 100755 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -5,7 +5,12 @@ from optparse import OptionParser AVAILABLE_DATABASES = { 'psql': {'ENGINE': 'django.db.backends.postgresql_psycopg2'}, - 'mysql': {'ENGINE': 'django.db.backends.mysql'}, + 'mysql': { + 'ENGINE': 'django.db.backends.mysql', + 'OPTIONS': { + 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'" + }, + }, 'sqlite': {'ENGINE': 'django.db.backends.sqlite3'}, } @@ -103,7 +108,10 @@ def main(): TEMPLATES=[{ 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['templates'], - 'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth']}, + 'OPTIONS': {'context_processors': [ + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ]}, 'APP_DIRS': True, }], ) diff --git a/watson/backends.py b/watson/backends.py index 2efb01a..30aceee 100644 --- a/watson/backends.py +++ b/watson/backends.py @@ -17,8 +17,8 @@ from watson.models import SearchEntry, has_int_pk def regex_from_word(word): - """Generates a regext from the given search word.""" - return "(\s{word})|(^{word})".format( + """Generates a regex from the given search word.""" + return r"(\s{word})|(^{word})".format( word=re.escape(word), )