Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit b4be0d2487532766a8709c0333e63ecbee96427d 1 parent a371eb3
Adrian Holovaty authored

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/db/models/query.py
4  django/db/models/query.py
@@ -3,8 +3,8 @@
3 3
 from django.db.models import signals
4 4
 from django.dispatch import dispatcher
5 5
 from django.utils.datastructures import SortedDict
6  
-
7 6
 import operator
  7
+import re
8 8
 
9 9
 # For Python 2.3
10 10
 if not hasattr(__builtins__, 'set'):
@@ -59,7 +59,7 @@ def orderlist2sql(order_list, opts, prefix=''):
59 59
     return ', '.join(output)
60 60
 
61 61
 def quote_only_if_word(word):
62  
-    if ' ' in word:
  62
+    if re.search('\W', word): # Don't quote if there are spaces or non-word chars.
63 63
         return word
64 64
     else:
65 65
         return backend.quote_name(word)

0 notes on commit b4be0d2

Please sign in to comment.
Something went wrong with that request. Please try again.