Modify

Ticket #4 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Exception при non-ascii символах в query string (django)

Reported by: lorien@… Owned by: lostclus
Priority: major Component: general
Version: Keywords:
Cc:

Description

Код linkexchange из транка. Сhangeset: 163:60f64ee57ea9

Traceback (most recent call last):

 File "/srv/data/web/web/omprice/.env/src/django/django/core/handlers/base.py", line 92, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/srv/data/web/web/omprice/.env/src/django-common/common/decorators.py", line 24, in wrapper
   kwargs = {'context_instance': RequestContext(request)}

 File "/srv/data/web/web/omprice/.env/src/django/django/template/context.py", line 107, in __init__
   self.update(processor(request))

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/django/context_processors.py", line 30, in linkexchange
   page_request = support.convert_request(request)

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/django/support.py", line 102, in convert_request
   ('?' + query_string) or '')

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 13: ordinal not in range(128)


<WSGIRequest
GET:<QueryDict: {u'firm': [u''], u'query': [u'\u041d\u043e\u0443\u0442\u0431\u0443\u043a'], u'page': [u'2']}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'CONTENT_LENGTH': '',
 'CONTENT_TYPE': '',
 'DOCUMENT_ROOT': '/usr/local/nginx/html',
 'DOCUMENT_URI': '/search/',
 'FCGI_ROLE': 'RESPONDER',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*',
 'HTTP_ACCEPT_LANGUAGE': 'ru',
 'HTTP_CONNECTION': 'Keep-Alive',
 'HTTP_HOST': 'omprice.ru',
 'HTTP_REFERER': 'http://omprice.ru/search/?query=%D0%9D%D0%BE%D1%83%D1%82%D0%B1%D1%83%D0%BA&firm=',
 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727)',
 'HTTP_VIA': '1.1 OMSKPROXY',
 'PATH_INFO': u'/search/',
 'QUERY_STRING': 'firm=&query=\xd0\x9d\xd0\xbe\xd1\x83\xd1\x82\xd0\xb1\xd1\x83\xd0\xba&page=2',
 'REDIRECT_STATUS': '200',
 'REMOTE_ADDR': '91.144.168.49',
 'REMOTE_PORT': '47467',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '/search/?firm=&query=\xd0\x9d\xd0\xbe\xd1\x83\xd1\x82\xd0\xb1\xd1\x83\xd0\xba&page=2',
— Скрыть цитируемый текст —
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': '92.243.0.209',
 'SERVER_NAME': 'omprice.ru',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'nginx/0.6.32',
 'wsgi.errors': <fcgi.Stream object at 0xb7d269b0>,
 'wsgi.input': <fcgi.Stream object at 0xb7d26990>,
 'wsgi.multiprocess': True,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>

Attachments

Change History

comment:1 Changed 2 years ago by lostclus

Попробуйте ревизию 79.

comment:2 Changed 2 years ago by lostclus

  • Owner set to lostclus
  • Status changed from new to accepted

comment:3 Changed 2 years ago by lorien@…

А вот такой ещё выпадывает теперь exception :-)

Traceback (most recent call last):

 File "/srv/data/web/web/omprice/.env/src/django/django/core/handlers/base.py", line 92, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/srv/data/web/web/omprice/.env/src/django-common/common/decorators.py", line 24, in wrapper
   kwargs = {'context_instance': RequestContext(request)}

 File "/srv/data/web/web/omprice/.env/src/django/django/template/context.py", line 107, in __init__
   self.update(processor(request))

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/django/context_processors.py", line 35, in linkexchange
   page_request, support.formatters)

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/platform.py", line 120, in get_blocks
   links = self.get_raw_links(request)

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/platform.py", line 101, in get_raw_links
   links = cl.get_raw_links(request)

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/clients/sape.py", line 205, in get_raw_links
   log.debug("Getting raw links for: %s", request.url())

 File "/srv/data/web/web/omprice/.env/src/linkexchange/linkexchange/clients/base.py", line 62, in url
   return '%s://%s%s' % (self.type, self.host, self.uri)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 20: ordinal not in range(128)


<WSGIRequest
GET:<QueryDict: {u'firm': [u''], u'query': [u'\u0432\u0438\u0434\u0435\u043e\u0437\u0430\u0445\u0432\u0430\u0442'], u'page': [u'2']}>,
POST:<QueryDict: {}>,
COOKIES:{},
META:{'CONTENT_LENGTH': '',
 'CONTENT_TYPE': '',
 'DOCUMENT_ROOT': '/usr/local/nginx/html',
 'DOCUMENT_URI': '/search/',
 'FCGI_ROLE': 'RESPONDER',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'application/x-ms-application, image/jpeg, application/xaml+xml, image/gif, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate',
 'HTTP_ACCEPT_LANGUAGE': 'ru-RU',
 'HTTP_CONNECTION': 'Keep-Alive',
 'HTTP_HOST': 'www.omprice.ru',
 'HTTP_REFERER': 'http://www.omprice.ru/search/?query=%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE%D0%B7%D0%B0%D1%85%D0%B2%D0%B0%D1%82&firm=',
 'HTTP_USER_AGENT': 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; MRA 5.5 (build 02842); SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; OfficeLiveConnector.1.4; OfficeLivePatch.1.3; msn OptimizedIE8;RURU)',
 'PATH_INFO': u'/search/',
 'QUERY_STRING': 'firm=&query=\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5\xd0\xbe\xd0\xb7\xd0\xb0\xd1\x85\xd0\xb2\xd0\xb0\xd1\x82&page=2',
 'REDIRECT_STATUS': '200',
 'REMOTE_ADDR': '188.186.233.171',
 'REMOTE_PORT': '52498',
 'REQUEST_METHOD': 'GET',
 'REQUEST_URI': '/search/?firm=&query=\xd0\xb2\xd0\xb8\xd0\xb4\xd0\xb5\xd0\xbe\xd0\xb7\xd0\xb0\xd1\x85\xd0\xb2\xd0\xb0\xd1\x82&page=2',
 'SCRIPT_NAME': u'',
 'SERVER_ADDR': '92.243.0.209',
 'SERVER_NAME': 'omprice.ru',
 'SERVER_PORT': '80',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'nginx/0.6.32',
 'wsgi.errors': <fcgi.Stream object at 0xb7d49ac0>,
 'wsgi.input': <fcgi.Stream object at 0xb7d49aa0>,
— Скрыть цитируемый текст —
 'wsgi.multiprocess': True,
 'wsgi.multithread': True,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0)}>

comment:4 Changed 2 years ago by lostclus

Пробуйте 82.

comment:5 Changed 2 years ago by lostclus

  • Status changed from accepted to closed
  • Resolution set to fixed
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.