Merge branch 'hotfix/v0.9.1' into development
This commit is contained in:
@@ -10,7 +10,7 @@ class RecentSearchManager(models.Manager):
|
||||
def add_query_for_user(self, user, query, hits):
|
||||
parsed_query = urlparse.parse_qs(query)
|
||||
for key, value in parsed_query.items():
|
||||
parsed_query[key] = u' '.join(value)
|
||||
parsed_query[key] = ' '.join(value)
|
||||
|
||||
if 'q=' in query:
|
||||
# Is a simple query
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import urlparse
|
||||
import urllib
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
@@ -6,6 +7,7 @@ from django.db import models
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.encoding import smart_unicode, smart_str
|
||||
|
||||
from dynamic_search.managers import RecentSearchManager
|
||||
from dynamic_search.api import registered_search_dict
|
||||
@@ -23,10 +25,10 @@ class RecentSearch(models.Model):
|
||||
objects = RecentSearchManager()
|
||||
|
||||
def __unicode__(self):
|
||||
query_dict = urlparse.parse_qs(self.query)
|
||||
query_dict = urlparse.parse_qs(urllib.unquote_plus(smart_str(self.query)))
|
||||
if 'q' in query_dict:
|
||||
# Is a simple search
|
||||
display_string = u' '.join(query_dict['q'])
|
||||
display_string = smart_unicode(' '.join(query_dict['q']))
|
||||
else:
|
||||
# Advanced search
|
||||
advanced_string = []
|
||||
@@ -38,7 +40,7 @@ class RecentSearch(models.Model):
|
||||
# Find the field name title
|
||||
for model_field in model_entry.get('fields', [{}]):
|
||||
if model_field.get('name') == field_name:
|
||||
advanced_string.append(u'%s: %s' % (model_field.get('title', model_field['name']), u' '.join(value)))
|
||||
advanced_string.append(u'%s: %s' % (model_field.get('title', model_field['name']), smart_unicode(' '.join(value))))
|
||||
|
||||
display_string = u', '.join(advanced_string)
|
||||
return u'%s (%s)' % (display_string, self.hits)
|
||||
|
||||
@@ -21,7 +21,7 @@ admin_site = {'text': _(u'admin site'), 'view': 'admin:index', 'famfam': 'keyboa
|
||||
__version_info__ = {
|
||||
'major': 0,
|
||||
'minor': 9,
|
||||
'micro': 0,
|
||||
'micro': 1,
|
||||
'releaselevel': 'final',
|
||||
'serial': 0
|
||||
}
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
Version 0.9.1
|
||||
-------------
|
||||
* Added handling percent encoded unicode query strings in search URL,
|
||||
thanks to (Сергей Глита [Sergei Glita]) for reporting.
|
||||
* Added a FAQ explaing how to fix MySQL collation related error when
|
||||
doing searches also thanks to (Сергей Глита [Sergei Glita]) for
|
||||
reporting this one.
|
||||
|
||||
Version 0.9.0
|
||||
-------------
|
||||
* Simplified getting mimetypes from files by merging 2 implementations
|
||||
|
||||
@@ -20,6 +20,7 @@ Bug reports
|
||||
* Joost Cassee (joost@cassee.net, https://github.com/jcassee)
|
||||
* Brian Huxley
|
||||
* dAnjou (https://github.com/dAnjou)
|
||||
* Сергей Глита [Sergey Glita] (s.v.glita@gmail.com)
|
||||
|
||||
Patches
|
||||
-------
|
||||
|
||||
22
docs/faq.rst
22
docs/faq.rst
@@ -5,6 +5,28 @@ FAQ
|
||||
Frequently asked questions and solutions
|
||||
|
||||
|
||||
|
||||
_mysql_exceptions.OperationalError: (1267, "Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='")
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
* Solution::
|
||||
|
||||
$ manage.py shell
|
||||
>>> from django.db import connection
|
||||
>>> cursor = connection.cursor()
|
||||
>>> cursor.execute('SHOW TABLES')
|
||||
>>> results=[]
|
||||
>>> for row in cursor.fetchall(): results.append(row)
|
||||
>>> for row in results: cursor.execute('ALTER TABLE %s CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;' % (row[0]))
|
||||
|
||||
|
||||
* References:
|
||||
|
||||
- http://www.djangoshmango.com/?p=99
|
||||
- http://stackoverflow.com/questions/1073295/django-character-set-with-mysql-weirdness
|
||||
|
||||
|
||||
|
||||
Incorrect string value: ``'\xE2\x80\x95rs6...'`` for column ``'content'`` at row 1
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user