summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-06-01 04:47:56 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-06-01 04:47:56 +0000
commitb4be0d2487532766a8709c0333e63ecbee96427d (patch)
tree560747d1117d8543b9266326ccee7d47a3a94100
parenta371eb3c9004d1a88b27a50822c594d2af10dfce (diff)
Fixed #1454 -- Improved DB API quote_only_if_word() so that it doesn't quote 'select' parameters that are not all word characters. Thanks, dja@cdc.msbx.net
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3044 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/query.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/query.py b/django/db/models/query.py
index fe31eaf45f..3517d6bed5 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -3,8 +3,8 @@ from django.db.models.fields import DateField, FieldDoesNotExist
from django.db.models import signals
from django.dispatch import dispatcher
from django.utils.datastructures import SortedDict
-
import operator
+import re
# For Python 2.3
if not hasattr(__builtins__, 'set'):
@@ -59,7 +59,7 @@ def orderlist2sql(order_list, opts, prefix=''):
return ', '.join(output)
def quote_only_if_word(word):
- if ' ' in word:
+ if re.search('\W', word): # Don't quote if there are spaces or non-word chars.
return word
else:
return backend.quote_name(word)