[Chicago] Unicode-ASCII encoding issues

Kumar McMillan kumar.mcmillan at gmail.com
Mon Nov 15 22:05:26 CET 2010


On Mon, Nov 15, 2010 at 8:55 AM, Ken Schutte <kenschutte at gmail.com> wrote:

> It looks like 'message' is already encoded.  For example, your value,
>
> >>> m = 'Phone.description(2) changed by: jonathan to:
> \xe2\x80\xa6\xe2\x80\x94\xe2\x86\x92\n'
> >>> unicode(m)
>

to further elaborate, you've encountered a confusing part of Python.  The
call to unicode(m) is the same as unicode(m, sys.getdefaultencoding()) or
more succinctly, m.decode(sys.getdefaultencoding()).  This is probably the
same as m.decode('ascii') on your machine.

so don't do that.

Do :

unicode(m, 'utf8') if you are sure it is utf8 otherwise you need to use
chardet -- http://chardet.feedparser.org/ -- or check the HTTP request
headers (which aren't always reliable).

It's pretty crappy that Python lets you "fall back" to the default encoding
but then again PHP developers will complain that an exception gets raised at
all, which will render your website useless in Python.  In Python 3 the
default is better but you *still* have to deal with all the different ways
bytestrings can be encoded.  Good luck!


> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 46:
> ordinal not in range(128)
>
> gives an error.  But,
>
> >>> unicode(m.decode('utf8'))
> u'Phone.description(2) changed by: jonathan to: \u2026\u2014\u2192\n'
>
>
> It okay (althought I'm not sure if that's the right encoding).
>
>
> See if you still get an error by replacing 'unicode(message)' with
> 'unicode(message.decode('utf8'))'.
>
> Generally, you don't need to wrap everything in unicode().  Be sure your
> original inputs are unicode, then simple "+" and Python with do the right
> thing.
>
> Then, worry about encodings only when you finally serialize,
>
> myfile.write(final_message.encode('utf8'))
>
>
>
> Ken
>
>
>
> On Fri, Nov 12, 2010 at 9:48 PM, Jonathan Hayward <
> christos.jonathan.hayward at gmail.com> wrote:
>
>> My first attempt at getting UTF-8 encoded logging to a logfilie is
>> failing; the last piece of code in the error page below is pasted here at
>> the top. What's an appropriate way to correct this first attempt? Wrapping
>> the time.asctime() in unicode() did not change the behavior.
>>
>>
>>    1.
>>    def log_message(message):
>>    2. log_file = os.path.join(os.path.dirname(__file__),
>>    3. directory.settings.LOGFILE)
>>    4. open(log_file, u'a').write(time.asctime() + u': ' +
>>
>>
>>    1. unicode(message).encode(u'utf-8') + u'\n')
>>
>> *TTAdd new <http://localhost:8000/> • Bad network connection?<http://localhost:8000/>
>>  • Log out*
>>
>>  UnicodeDecodeError at /ajax/save
>>
>> 'ascii' codec can't decode byte 0xe2 in position 46: ordinal not in range(128)
>>
>>  Request Method:POST Request URL:http://localhost:8000/ajax/save Django
>> Version:1.2.1 Exception Type:UnicodeDecodeError Exception Value:
>>
>> 'ascii' codec can't decode byte 0xe2 in position 46: ordinal not in range(128)
>>
>>  Exception Location:/Users/jonathan/directory/../directory/functions.py
>> in log_message, line 67 Python Executable:
>> /opt/local/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python Python
>> Version:2.6.6 Python Path:['/Users/jonathan/directory',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/gtk-2.0',
>> '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info'] Server
>> time:Fri, 12 Nov 2010 21:38:22 -0600
>> Unicode error hint
>>
>> The string that could not be encoded/decoded was: *to: ������*
>>  Traceback Switch to copy-and-paste view<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7#>
>>
>>    -
>>    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/handlers/base.py
>>     in get_response
>>     1. # Apply view middleware
>>       2. for middleware_method in self._view_middleware:
>>       3. response = middleware_method(request, callback, callback_args,
>>       callback_kwargs)
>>       4. if response:
>>       5. return response
>>       6.
>>       7. try:
>>    1. response = callback(request, *callback_args, **callback_kwargs) ...
>>    1. except Exception, e:
>>       2. # If the view raised an exception, run it through exception
>>       3. # middleware, and if the exception middleware returns a
>>       4. # response, use that. Otherwise, reraise the exception.
>>       5. for middleware_method in self._exception_middleware:
>>       6. response = middleware_method(request, e)
>>    ▶ Local vars<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7#>
>>      Variable Value callback
>>    <function wrap at 0x101f4d320>
>>     callback_args
>>    ()
>>     callback_kwargs
>>    {}
>>     e
>>    UnicodeDecodeError('ascii', 'Phone.description(2) changed by: jonathan
>>    to: \xe2\x80\xa6\xe2\x80\x94\xe2\x86\x92\n', 46, 47, 'ordinal not in
>>    range(128)')
>>     exc_info
>>    (<type 'exceptions.UnicodeDecodeError'>, UnicodeDecodeError('ascii',
>>    'Phone.description(2) changed by: jonathan to:
>>    \xe2\x80\xa6\xe2\x80\x94\xe2\x86\x92\n', 46, 47, 'ordinal not in
>>    range(128)'), <traceback object at 0x101d84128>)
>>     exceptions
>>    <module 'django.core.exceptions' from
>>    '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/exceptions.pyc'>
>>     middleware_method
>>    <bound method AuthenticationMiddleware.process_request of
>>    <django.contrib.auth.middleware.AuthenticationMiddleware object at
>>    0x101d96a10>>
>>     receivers
>>    [(<function _rollback_on_exception at 0x1014b70c8>, None)]
>>     request
>>    <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {u'id':
>>    [u'Phone_2'], u'value': [u'\u2026\u2014\u2192']}>, COOKIES:{'csrftoken':
>>    'a2589ffcf0fe1503cdc253c24c28aeb2', 'sessionid':
>>    '1d97009d8d9f5d7a89334795c327981e'}, META:{'Apple_PubSub_Socket_Render':
>>    '/tmp/launch-p6njfE/Render', 'COMMAND_MODE': 'unix2003', 'CONTENT_LENGTH':
>>    '44', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'DISPLAY':
>>    '/tmp/launch-15itE9/org.x:0', 'DJANGO_SETTINGS_MODULE':
>>    'directory.settings', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HOME':
>>    '/Users/jonathan', 'HTTP_ACCEPT': 'text/html, */*', 'HTTP_ACCEPT_CHARSET':
>>    'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_ENCODING':
>>    'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
>>    'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
>>    'csrftoken=a2589ffcf0fe1503cdc253c24c28aeb2;
>>    sessionid=1d97009d8d9f5d7a89334795c327981e', 'HTTP_HOST': 'localhost:8000',
>>    'HTTP_ORIGIN': 'http://localhost:8000', 'HTTP_REFERER': '
>>    http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7',
>>    'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US)
>>    AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7',
>>    'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'LANG': 'en_US.UTF-8', 'LOGNAME':
>>    'jonathan', 'OLDPWD': '/Users/jonathan', 'PATH':
>>    '/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin:/usr/games::/usr/local/bin:/Users/jonathanhayward/bin:/Users/jonathanhayward/bintmp:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin',
>>    'PATH_INFO': u'/ajax/save', 'PWD': '/Users/jonathan/directory',
>>    'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': '',
>>    'REQUEST_METHOD': 'POST', 'RUN_MAIN': 'true', 'SCRIPT_NAME': u'',
>>    'SECURITYSESSIONID': '306880', 'SERVER_NAME':
>>    'jonathan-haywards-computer.local', 'SERVER_PORT': '8000',
>>    'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.1
>>    Python/2.6.6', 'SHELL': '/bin/bash', 'SHLVL': '1', 'SSH_AUTH_SOCK':
>>    '/tmp/launch-4X29Vc/Listeners', 'TERM': 'xterm-color', 'TERM_PROGRAM':
>>    'Apple_Terminal', 'TERM_PROGRAM_VERSION': '273', 'TMPDIR':
>>    '/var/folders/I7/I7mxSwItEtS7OWilJ-fnm++++TQ/-Tmp-/', 'TZ':
>>    'America/Chicago', 'USER': 'jonathan', '_': '/opt/local/bin/python',
>>    '__CF_USER_TEXT_ENCODING': '0x1F7:0:0', 'wsgi.errors': <open file
>>    '<stderr>', mode 'w' at 0x1002541e0>, 'wsgi.file_wrapper': <class
>>    'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input':
>>    <socket._fileobject object at 0x101d82250>, 'wsgi.multiprocess': False,
>>    'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http',
>>    'wsgi.version': (1, 0)}>
>>     resolver
>>    <RegexURLResolver directory.urls (None:None) ^/>
>>     response
>>    None
>>     self
>>    <django.core.handlers.wsgi.WSGIHandler object at 0x101d810d0>
>>     settings
>>    <django.conf.LazySettings object at 0x1007a2c50>
>>     urlconf
>>    'directory.urls'
>>     urlresolvers
>>    <module 'django.core.urlresolvers' from
>>    '/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/urlresolvers.pyc'>
>>    - /Users/jonathan/directory/../directory/functions.py in wrap
>>     1. import os
>>       2. import re
>>       3. import time
>>       4.
>>       5. def ajax_login_required(view_function):
>>       6. def wrap(request, *arguments, **keywords):
>>       7. if request.user.is_authenticated():
>>    1. return view_function(request, *arguments, **keywords) ...
>>    1. output = json.dumps({ u'not_authenticated': True })
>>       2. return HttpResponse(output, mimetype = u'application/json')
>>       3. wrap.__doc__ = view_function.__doc__
>>       4. wrap.__dict__ = view_function.__dict__
>>       5. return wrap
>>       6.
>>    ▶ Local vars<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7#>
>>      Variable Value arguments
>>    ()
>>     keywords
>>    {}
>>     request
>>    <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {u'id':
>>    [u'Phone_2'], u'value': [u'\u2026\u2014\u2192']}>, COOKIES:{'csrftoken':
>>    'a2589ffcf0fe1503cdc253c24c28aeb2', 'sessionid':
>>    '1d97009d8d9f5d7a89334795c327981e'}, META:{'Apple_PubSub_Socket_Render':
>>    '/tmp/launch-p6njfE/Render', 'COMMAND_MODE': 'unix2003', 'CONTENT_LENGTH':
>>    '44', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'DISPLAY':
>>    '/tmp/launch-15itE9/org.x:0', 'DJANGO_SETTINGS_MODULE':
>>    'directory.settings', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HOME':
>>    '/Users/jonathan', 'HTTP_ACCEPT': 'text/html, */*', 'HTTP_ACCEPT_CHARSET':
>>    'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_ENCODING':
>>    'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
>>    'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
>>    'csrftoken=a2589ffcf0fe1503cdc253c24c28aeb2;
>>    sessionid=1d97009d8d9f5d7a89334795c327981e', 'HTTP_HOST': 'localhost:8000',
>>    'HTTP_ORIGIN': 'http://localhost:8000', 'HTTP_REFERER': '
>>    http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7',
>>    'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US)
>>    AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7',
>>    'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'LANG': 'en_US.UTF-8', 'LOGNAME':
>>    'jonathan', 'OLDPWD': '/Users/jonathan', 'PATH':
>>    '/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin:/usr/games::/usr/local/bin:/Users/jonathanhayward/bin:/Users/jonathanhayward/bintmp:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin',
>>    'PATH_INFO': u'/ajax/save', 'PWD': '/Users/jonathan/directory',
>>    'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': '',
>>    'REQUEST_METHOD': 'POST', 'RUN_MAIN': 'true', 'SCRIPT_NAME': u'',
>>    'SECURITYSESSIONID': '306880', 'SERVER_NAME':
>>    'jonathan-haywards-computer.local', 'SERVER_PORT': '8000',
>>    'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.1
>>    Python/2.6.6', 'SHELL': '/bin/bash', 'SHLVL': '1', 'SSH_AUTH_SOCK':
>>    '/tmp/launch-4X29Vc/Listeners', 'TERM': 'xterm-color', 'TERM_PROGRAM':
>>    'Apple_Terminal', 'TERM_PROGRAM_VERSION': '273', 'TMPDIR':
>>    '/var/folders/I7/I7mxSwItEtS7OWilJ-fnm++++TQ/-Tmp-/', 'TZ':
>>    'America/Chicago', 'USER': 'jonathan', '_': '/opt/local/bin/python',
>>    '__CF_USER_TEXT_ENCODING': '0x1F7:0:0', 'wsgi.errors': <open file
>>    '<stderr>', mode 'w' at 0x1002541e0>, 'wsgi.file_wrapper': <class
>>    'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input':
>>    <socket._fileobject object at 0x101d82250>, 'wsgi.multiprocess': False,
>>    'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http',
>>    'wsgi.version': (1, 0)}>
>>     view_function
>>    <function save at 0x101f4d2a8>
>>    - /Users/jonathan/directory/../directory/views.py in save
>>     1. change_set = None
>>       2. if original_value != value:
>>       3. change_set = register_edit(TEXT_CHANGED, instance, session,
>>       4. username, request.META[u'REMOTE_ADDR'], field_name = field,
>>       5. text_before = original_value, text_after = value)
>>       6. directory.functions.log_message(unicode(model) + u'.' +
>>       7. unicode(field) + "(" + unicode(id) + u') changed by: ' +
>>    1. unicode(request.user.username) + u' to: ' + unicode(value) + u'\n')
>>       ...
>>    1. if change_set != None:
>>       2. return HttpResponse(value + u'<!--# ' + unicode(change_set) + u'
>>       #-->')
>>       3. else:
>>       4. return HttpResponse(value)
>>       5.
>>       6. @ajax_login_required
>>    ▶ Local vars<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7#>
>>      Variable Value change_set
>>    None
>>     dictionary
>>    <QueryDict: {u'id': [u'Phone_2'], u'value': [u'\u2026\u2014\u2192']}>
>>     field
>>    u'description'
>>     html_id
>>    u'Phone_2'
>>     id
>>    2
>>     instance
>>    <Phone: Phone object>
>>     match
>>    <_sre.SRE_Match object at 0x101f0e690>
>>     model
>>    u'Phone'
>>     original_value
>>    u'\u2026\u2014\u2192'
>>     request
>>    <WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {u'id':
>>    [u'Phone_2'], u'value': [u'\u2026\u2014\u2192']}>, COOKIES:{'csrftoken':
>>    'a2589ffcf0fe1503cdc253c24c28aeb2', 'sessionid':
>>    '1d97009d8d9f5d7a89334795c327981e'}, META:{'Apple_PubSub_Socket_Render':
>>    '/tmp/launch-p6njfE/Render', 'COMMAND_MODE': 'unix2003', 'CONTENT_LENGTH':
>>    '44', 'CONTENT_TYPE': 'application/x-www-form-urlencoded', 'DISPLAY':
>>    '/tmp/launch-15itE9/org.x:0', 'DJANGO_SETTINGS_MODULE':
>>    'directory.settings', 'GATEWAY_INTERFACE': 'CGI/1.1', 'HOME':
>>    '/Users/jonathan', 'HTTP_ACCEPT': 'text/html, */*', 'HTTP_ACCEPT_CHARSET':
>>    'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_ACCEPT_ENCODING':
>>    'gzip,deflate,sdch', 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8',
>>    'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
>>    'csrftoken=a2589ffcf0fe1503cdc253c24c28aeb2;
>>    sessionid=1d97009d8d9f5d7a89334795c327981e', 'HTTP_HOST': 'localhost:8000',
>>    'HTTP_ORIGIN': 'http://localhost:8000', 'HTTP_REFERER': '
>>    http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7',
>>    'HTTP_USER_AGENT': 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US)
>>    AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7',
>>    'HTTP_X_REQUESTED_WITH': 'XMLHttpRequest', 'LANG': 'en_US.UTF-8', 'LOGNAME':
>>    'jonathan', 'OLDPWD': '/Users/jonathan', 'PATH':
>>    '/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin:/usr/games::/usr/local/bin:/Users/jonathanhayward/bin:/Users/jonathanhayward/bintmp:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin',
>>    'PATH_INFO': u'/ajax/save', 'PWD': '/Users/jonathan/directory',
>>    'QUERY_STRING': '', 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': '',
>>    'REQUEST_METHOD': 'POST', 'RUN_MAIN': 'true', 'SCRIPT_NAME': u'',
>>    'SECURITYSESSIONID': '306880', 'SERVER_NAME':
>>    'jonathan-haywards-computer.local', 'SERVER_PORT': '8000',
>>    'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.1
>>    Python/2.6.6', 'SHELL': '/bin/bash', 'SHLVL': '1', 'SSH_AUTH_SOCK':
>>    '/tmp/launch-4X29Vc/Listeners', 'TERM': 'xterm-color', 'TERM_PROGRAM':
>>    'Apple_Terminal', 'TERM_PROGRAM_VERSION': '273', 'TMPDIR':
>>    '/var/folders/I7/I7mxSwItEtS7OWilJ-fnm++++TQ/-Tmp-/', 'TZ':
>>    'America/Chicago', 'USER': 'jonathan', '_': '/opt/local/bin/python',
>>    '__CF_USER_TEXT_ENCODING': '0x1F7:0:0', 'wsgi.errors': <open file
>>    '<stderr>', mode 'w' at 0x1002541e0>, 'wsgi.file_wrapper': <class
>>    'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input':
>>    <socket._fileobject object at 0x101d82250>, 'wsgi.multiprocess': False,
>>    'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http',
>>    'wsgi.version': (1, 0)}>
>>     selected_model
>>    <class 'directory.models.Phone'>
>>     session
>>    '1d97009d8d9f5d7a89334795c327981e'
>>     username
>>    u'jonathan'
>>     value
>>    u'\u2026\u2014\u2192'
>>    - /Users/jonathan/directory/../directory/functions.py in log_message
>>     1. result += time.strftime(u', %Y')
>>       2. return result
>>       3.
>>       4. def log_message(message):
>>       5. log_file = os.path.join(os.path.dirname(__file__),
>>       6. directory.settings.LOGFILE)
>>       7. open(log_file, u'a').write(time.asctime() + u': ' +
>>    1. unicode(message).encode(u'utf-8') + u'\n') ...
>>    1.
>>       2. def register_edit(change_type, instance, session, username, ip,
>>       change_set =
>>       3. None, content_type = None, field_name = None, foreign_key_added
>>       = None,
>>       4. foreign_key_deleted = None, text_before = None, text_after =
>>       None):
>>       5. edit = directory.models.EditTrail()
>>       6. edit.object_id = instance.id
>>    ▶ Local vars<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7#>
>>      Variable Value log_file
>>    u'/Users/jonathan/directory/../directory/log'
>>     message
>>    u'Phone.description(2) changed by: jonathan to: \u2026\u2014\u2192\n'
>>
>>
>>
>>  Request information GET
>>
>> No GET data
>> POST  Variable Value id
>> u'Phone_2'
>>  value
>> u'\u2026\u2014\u2192'
>>  FILES
>>
>> No FILES data
>> COOKIES  Variable Value csrftoken
>> 'a2589ffcf0fe1503cdc253c24c28aeb2'
>>  sessionid
>> '1d97009d8d9f5d7a89334795c327981e'
>>  META  Variable Value Apple_PubSub_Socket_Render
>> '/tmp/launch-p6njfE/Render'
>>  COMMAND_MODE
>> 'unix2003'
>>  CONTENT_LENGTH
>> '44'
>>  CONTENT_TYPE
>> 'application/x-www-form-urlencoded'
>>  DISPLAY
>> '/tmp/launch-15itE9/org.x:0'
>>  DJANGO_SETTINGS_MODULE
>> 'directory.settings'
>>  GATEWAY_INTERFACE
>> 'CGI/1.1'
>>  HOME
>> '/Users/jonathan'
>>  HTTP_ACCEPT
>> 'text/html, */*'
>>  HTTP_ACCEPT_CHARSET
>> 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
>>  HTTP_ACCEPT_ENCODING
>> 'gzip,deflate,sdch'
>>  HTTP_ACCEPT_LANGUAGE
>> 'en-US,en;q=0.8'
>>  HTTP_CONNECTION
>> 'keep-alive'
>>  HTTP_COOKIE
>> 'csrftoken=a2589ffcf0fe1503cdc253c24c28aeb2;
>> sessionid=1d97009d8d9f5d7a89334795c327981e'
>>  HTTP_HOST
>> 'localhost:8000'
>>  HTTP_ORIGIN
>> 'http://localhost:8000'
>>  HTTP_REFERER
>> 'http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7'
>>  HTTP_USER_AGENT
>> 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US)
>> AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.41 Safari/534.7'
>>  HTTP_X_REQUESTED_WITH
>> 'XMLHttpRequest'
>>  LANG
>> 'en_US.UTF-8'
>>  LOGNAME
>> 'jonathan'
>>  OLDPWD
>> '/Users/jonathan'
>>  PATH
>>
>> '/opt/local/bin:/opt/local/sbin:/usr/X11R6/bin:/usr/games::/usr/local/bin:/Users/jonathanhayward/bin:/Users/jonathanhayward/bintmp:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin'
>>  PATH_INFO
>> u'/ajax/save'
>>  PWD
>> '/Users/jonathan/directory'
>>  QUERY_STRING
>> ''
>>  REMOTE_ADDR
>> '127.0.0.1'
>>  REMOTE_HOST
>> ''
>>  REQUEST_METHOD
>> 'POST'
>>  RUN_MAIN
>> 'true'
>>  SCRIPT_NAME
>> u''
>>  SECURITYSESSIONID
>> '306880'
>>  SERVER_NAME
>> 'jonathan-haywards-computer.local'
>>  SERVER_PORT
>> '8000'
>>  SERVER_PROTOCOL
>> 'HTTP/1.1'
>>  SERVER_SOFTWARE
>> 'WSGIServer/0.1 Python/2.6.6'
>>  SHELL
>> '/bin/bash'
>>  SHLVL
>> '1'
>>  SSH_AUTH_SOCK
>> '/tmp/launch-4X29Vc/Listeners'
>>  TERM
>> 'xterm-color'
>>  TERM_PROGRAM
>> 'Apple_Terminal'
>>  TERM_PROGRAM_VERSION
>> '273'
>>  TMPDIR
>> '/var/folders/I7/I7mxSwItEtS7OWilJ-fnm++++TQ/-Tmp-/'
>>  TZ
>> 'America/Chicago'
>>  USER
>> 'jonathan'
>>  _
>> '/opt/local/bin/python'
>>  __CF_USER_TEXT_ENCODING
>> '0x1F7:0:0'
>>  wsgi.errors
>> <open file '<stderr>', mode 'w' at 0x1002541e0>
>>  wsgi.file_wrapper
>> <class 'django.core.servers.basehttp.FileWrapper'>
>>  wsgi.input
>> <socket._fileobject object at 0x101d82250>
>>  wsgi.multiprocess
>> False
>>  wsgi.multithread
>> True
>>  wsgi.run_once
>> False
>>  wsgi.url_scheme
>> 'http'
>>  wsgi.version
>> (1, 0)
>>  SettingsUsing settings module directory.settings  Setting Value
>> ABSOLUTE_URL_OVERRIDES
>> {}
>>  ADMINS
>> ()
>>  ADMIN_FOR
>> ()
>>  ADMIN_MEDIA_PREFIX
>> '/media/'
>>  ALLOWED_INCLUDE_ROOTS
>> ()
>>  APPEND_SLASH
>> True
>>  AUTHENTICATION_BACKENDS
>> ('django.contrib.auth.backends.ModelBackend',)
>>  BANNED_IPS
>> ()
>>  CACHE_BACKEND
>> 'locmem://'
>>  CACHE_MIDDLEWARE_KEY_PREFIX
>> ''
>>  CACHE_MIDDLEWARE_SECONDS
>> 600
>>  COMMENTS_ALLOW_PROFANITIES
>> False
>>  COMMENTS_BANNED_USERS_GROUP
>> None
>>  COMMENTS_FIRST_FEW
>> 0
>>  COMMENTS_MODERATORS_GROUP
>> None
>>  COMMENTS_SKETCHY_USERS_GROUP
>> None
>>  CSRF_COOKIE_DOMAIN
>> None
>>  CSRF_COOKIE_NAME
>> 'csrftoken'
>>  CSRF_FAILURE_VIEW
>> 'django.views.csrf.csrf_failure'
>>  DATABASES
>> {'default': {'ENGINE': 'django.db.backends.sqlite3', 'HOST': '', 'NAME':
>> 'directory.sqlite3', 'OPTIONS': {}, 'PASSWORD': '********************',
>> 'PORT': '', 'TEST_CHARSET': None, 'TEST_COLLATION': None, 'TEST_MIRROR':
>> None, 'TEST_NAME': None, 'TIME_ZONE': 'America/Chicago', 'USER': ''}}
>>  DATABASE_ENGINE
>> 'sqlite3'
>>  DATABASE_HOST
>> ''
>>  DATABASE_NAME
>> 'directory.sqlite3'
>>  DATABASE_OPTIONS
>> {}
>>  DATABASE_PASSWORD
>> '********************'
>>  DATABASE_PORT
>> ''
>>  DATABASE_ROUTERS
>> []
>>  DATABASE_USER
>> ''
>>  DATETIME_FORMAT
>> 'N j, Y, P'
>>  DATETIME_INPUT_FORMATS
>> ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d', '%m/%d/%Y %H:%M:%S',
>> '%m/%d/%Y %H:%M', '%m/%d/%Y', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M',
>> '%m/%d/%y')
>>  DATE_FORMAT
>> 'N j, Y'
>>  DATE_INPUT_FORMATS
>> ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y',
>> '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
>>  DEBUG
>> True
>>  DEBUG_PROPAGATE_EXCEPTIONS
>> False
>>  DECIMAL_SEPARATOR
>> '.'
>>  DEFAULT_CHARSET
>> 'utf-8'
>>  DEFAULT_CONTENT_TYPE
>> 'text/html'
>>  DEFAULT_FILE_STORAGE
>> 'django.core.files.storage.FileSystemStorage'
>>  DEFAULT_FROM_EMAIL
>> 'webmaster at localhost'
>>  DEFAULT_INDEX_TABLESPACE
>> ''
>>  DEFAULT_TABLESPACE
>> ''
>>  DELAY_BETWEEN_RETRIES
>> 1
>>  DEPARTMENT_WEIGHT
>> 30
>>  DESCRIPTION_WEIGHT
>> 30
>>  DIRNAME
>> '/Users/jonathan/directory/../directory'
>>  DISALLOWED_USER_AGENTS
>> ()
>>  EMAIL_BACKEND
>> 'django.core.mail.backends.smtp.EmailBackend'
>>  EMAIL_HOST
>> 'localhost'
>>  EMAIL_HOST_PASSWORD
>> '********************'
>>  EMAIL_HOST_USER
>> ''
>>  EMAIL_PORT
>> 25
>>  EMAIL_SUBJECT_PREFIX
>> '[Django] '
>>  EMAIL_USE_TLS
>> False
>>  FILE_CHARSET
>> 'utf-8'
>>  FILE_UPLOAD_HANDLERS
>> ('django.core.files.uploadhandler.MemoryFileUploadHandler',
>> 'django.core.files.uploadhandler.TemporaryFileUploadHandler')
>>  FILE_UPLOAD_MAX_MEMORY_SIZE
>> 2621440
>>  FILE_UPLOAD_PERMISSIONS
>> None
>>  FILE_UPLOAD_TEMP_DIR
>> None
>>  FIRST_DAY_OF_WEEK
>> 0
>>  FIXTURE_DIRS
>> ()
>>  FORCE_SCRIPT_NAME
>> None
>>  FORMAT_MODULE_PATH
>> None
>>  IGNORABLE_404_ENDS
>> ('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico',
>> '.php')
>>  IGNORABLE_404_STARTS
>> ('/cgi-bin/', '/_vti_bin', '/_vti_inf')
>>  INITIAL_RESULTS
>> 10
>>  INITIAL_STATI
>> 5
>>  INSTALLED_APPS
>> ['directory', 'django.contrib.admin', 'django.contrib.auth',
>> 'django.contrib.contenttypes', 'django.contrib.sessions',
>> 'django.contrib.sites']
>>  INTERNAL_IPS
>> ()
>>  LANGUAGES
>> (('ar', 'Arabic'), ('bg', 'Bulgarian'), ('bn', 'Bengali'), ('bs',
>> 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da',
>> 'Danish'), ('de', 'German'), ('el', 'Greek'), ('en', 'English'), ('en-gb',
>> 'British English'), ('es', 'Spanish'), ('es-ar', 'Argentinean Spanish'),
>> ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'),
>> ('fr', 'French'), ('fy-nl', 'Frisian'), ('ga', 'Irish'), ('gl', 'Galician'),
>> ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hu', 'Hungarian'),
>> ('id', 'Indonesian'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja',
>> 'Japanese'), ('ka', 'Georgian'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko',
>> 'Korean'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'),
>> ('mn', 'Mongolian'), ('nl', 'Dutch'), ('no', 'Norwegian'), ('nb', 'Norwegian
>> Bokmal'), ('nn', 'Norwegian Nynorsk'), ('pl', 'Polish'), ('pt',
>> 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru',
>> 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'),
>> ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('ta',
>> 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('uk',
>> 'Ukrainian'), ('vi', 'Vietnamese'), ('zh-cn', 'Simplified Chinese'),
>> ('zh-tw', 'Traditional Chinese'))
>>  LANGUAGES_BIDI
>> ('he', 'ar', 'fa')
>>  LANGUAGE_CODE
>> 'en-us'
>>  LANGUAGE_COOKIE_NAME
>> 'django_language'
>>  LOCALE_PATHS
>> ()
>>  LOCATION_WEIGHT
>> 10
>>  LOGFILE
>> u'log'
>>  LOGIN_REDIRECT_URL
>> '/accounts/profile/'
>>  LOGIN_URL
>> '/accounts/login/'
>>  LOGOUT_URL
>> '/accounts/logout/'
>>  MANAGERS
>> ()
>>  MEDIA_ROOT
>> '/Users/jonathan/directory/../directory/static/'
>>  MEDIA_URL
>> '/static/'
>>  MESSAGE_STORAGE
>> 'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'
>>  MIDDLEWARE_CLASSES
>> ('django.middleware.common.CommonMiddleware',
>> 'django.contrib.sessions.middleware.SessionMiddleware',
>> 'django.contrib.auth.middleware.AuthenticationMiddleware')
>>  MONTH_DAY_FORMAT
>> 'F j'
>>  NAME_WEIGHT
>> 70
>>  NUMBER_GROUPING
>> 0
>>  PASSWORD_RESET_TIMEOUT_DAYS
>> '********************'
>>  PREPEND_WWW
>> False
>>  PROFANITIES_LIST
>> '********************'
>>  ROOT_URLCONF
>> 'directory.urls'
>>  SECRET_KEY
>> '********************'
>>  SEND_BROKEN_LINK_EMAILS
>> False
>>  SERVER_EMAIL
>> 'root at localhost'
>>  SESSION_COOKIE_AGE
>> 1209600
>>  SESSION_COOKIE_DOMAIN
>> None
>>  SESSION_COOKIE_NAME
>> 'sessionid'
>>  SESSION_COOKIE_PATH
>> '/'
>>  SESSION_COOKIE_SECURE
>> False
>>  SESSION_ENGINE
>> 'django.contrib.sessions.backends.db'
>>  SESSION_EXPIRE_AT_BROWSER_CLOSE
>> False
>>  SESSION_FILE_PATH
>> None
>>  SESSION_SAVE_EVERY_REQUEST
>> False
>>  SETTINGS_MODULE
>> 'directory.settings'
>>  SHORT_DATETIME_FORMAT
>> 'm/d/Y P'
>>  SHORT_DATE_FORMAT
>> 'm/d/Y'
>>  SHOULD_ALLOW_USERS_TO_CREATE_ACCOUNTS
>> 1
>>  SHOULD_DOWNLOAD_DIRECTORY
>> 1
>>  SHOULD_TURN_ON_HIJAXING
>> 0
>>  SITE_ID
>> 1
>>  STATUS_WEIGHT
>> 1
>>  TAG_WEIGHT
>> 50
>>  TEMPLATE_CONTEXT_PROCESSORS
>> ('django.contrib.auth.context_processors.auth',
>> 'django.core.context_processors.debug',
>> 'django.core.context_processors.i18n',
>> 'django.core.context_processors.media',
>> 'django.contrib.messages.context_processors.messages')
>>  TEMPLATE_DEBUG
>> True
>>  TEMPLATE_DIRS
>> ('/Users/jonathan/directory/../directory/templates',)
>>  TEMPLATE_LOADERS
>> ('django.template.loaders.filesystem.load_template_source',
>> 'django.template.loaders.app_directories.load_template_source')
>>  TEMPLATE_STRING_IF_INVALID
>> ''
>>  TEST_DATABASE_CHARSET
>> None
>>  TEST_DATABASE_COLLATION
>> None
>>  TEST_DATABASE_NAME
>> None
>>  TEST_RUNNER
>> 'django.test.simple.DjangoTestSuiteRunner'
>>  THOUSAND_SEPARATOR
>> ','
>>  TIME_FORMAT
>> 'P'
>>  TIME_INPUT_FORMATS
>> ('%H:%M:%S', '%H:%M')
>>  TIME_ZONE
>> 'America/Chicago'
>>  TITLE_WEIGHT
>> 50
>>  TRANSACTIONS_MANAGED
>> False
>>  URL_VALIDATOR_USER_AGENT
>> 'Django/1.2.1 (http://www.djangoproject.com)'
>>  USE_ETAGS
>> False
>>  USE_I18N
>> True
>>  USE_L10N
>> False
>>  USE_THOUSAND_SEPARATOR
>> False
>>  YEAR_MONTH_FORMAT
>> 'F Y'
>>
>> You're seeing this error because you have DEBUG = True in your Django
>> settings file. Change that to False, and Django will display a standard
>> 500 page.
>>
>> Photo directory: Search
>>  Search results
>>
>> Joel Goyeva<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=1>
>>
>> Jonathan Hayward<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=2>
>> Web Developer,
>> Test
>>
>> Alice Amazing<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=3>
>>
>> Test <http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=4>
>>
>> Grandma and Grandpa Hayward<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=5>
>>
>> (Insert name here)<http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=6>
>>
>> …—→ <http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=7>
>>
>> …—→ <http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=8>
>>
>> …—→ <http://localhost:8000/?query=%E2%80%A6%E2%80%94%E2%86%92&id=9>
>> …—→
>> People, etc.
>> Delete "…—→"
>>  …—→
>> Upload image:
>>
>> Upload
>>
>> Title: *Click to add.*
>>
>> Description: *Click to add.*
>>
>> Tags: *Click to add.*
>>
>> Phone:**
>>  *OKCancel ✘   Click to add.*
>>
>> Email: *Click to add.*
>>
>> Webpages: *Click to add.*
>>
>> GPS: *Click to add.*
>>
>> Postal address: *Click to add.*
>>
>> Other contact information: *Click to add.*
>>
>> Time zone:                       Select                      A: Paris,
>> +1:00                      B: Athens, +2:00                      C:
>> Moscow, +3:00                      D: Dubai, +4:00                      -:
>> Kabul, +4:30                      E: Karachi, +5:00                      -:
>> New Delhi, +5:30                      -: Kathmandu, :5:45
>>        F: Dhaka, +6:00                      -: Rangoon, +6:30
>>           G: Jakarta, +7:00                      H: Kuala Lumpur, +8:00
>>                    I: Tokyo, +9:00                      -: Adelaide,
>> +9:30                      K: Sydney, +10:00                      -: Lord
>> Howe Island, +10:30                      L: Solomon Islands, +11:00
>>                 -: Norfolk Island, +11:50                      M:
>> Auckland, +12:00                      -: Chatham Islands, +12:45
>>              -: Tonga, +13:00                      -: Line Islands,
>> +14:00                      N: Azores, -1:00                      O:
>> Fernando de Norohna, -2:00                      P: Rio de Janiero, -3:00
>>                    -: St. John's, -3:50                      Q: Santiago,
>> -4:00                      -: Caracas, -4:30                      R: New
>> York City, -5:00                      S: Chicago, -6:00
>>     T: Boulder, -7:00                      U: Los Angeles, -8:00
>>              V: Anchorage, -9:00                      -: Marquesas
>> Islands, -9:30                      W: Hawaii, -10:00
>>  X: Samoa, -11:00                      Y: Baker Island, -12:00
>>           Z: London, +0:00
>> Observes daylight saving time:
>>
>> Department: * <http://localhost:8000/?query=&id=>
>>     (Insert name here)                  Alice Amazing                  Grandma
>> and Grandpa Hayward                  Joel Goyeva                  Jonathan
>> Hayward                  Test                  …—→                  …—→
>>                 …—→           *
>>
>> Location: * <http://localhost:8000/?query=&id=>
>>     (Insert name here)                  Alice Amazing                  Grandma
>> and Grandpa Hayward                  Joel Goyeva                  Jonathan
>> Hayward                  Test                  …—→                  …—→
>>                 …—→           *
>>
>> Reports to: * <http://localhost:8000/?query=&id=>
>>     (Insert name here)                  Alice Amazing                  Grandma
>> and Grandpa Hayward                  Joel Goyeva                  Jonathan
>> Hayward                  Test                  …—→                  …—→
>>                 …—→           *
>>
>> Status:
>> Click to add.
>>
>>
>> --
>> [image: Christos Jonathan Hayward] <http://jonathanscorner.com/>
>> Christos Jonathan Hayward, an Orthodox Christian author.
>>
>> Author Bio <http://jonathanscorner.com/author/> • Books<http://cjshayward.com/>
>>  • *Email <christos.jonathan.hayward at gmail.com>* • Facebook<http://www.facebook.com/christos.jonathan.hayward>
>>  • LinkedIn <http://www.linkedin.com/in/jonathanhayward> • Twitter<http://twitter.com/JonathansCorner>
>>  • *Web <http://jonathanscorner.com/>* • What's New?<http://jonathanscorner.com/>
>> I invite you to visit my "theology, literature, and other creative works"
>> site.
>>
>>
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> http://mail.python.org/mailman/listinfo/chicago
>>
>>
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/chicago/attachments/20101115/ff432f33/attachment-0001.html>


More information about the Chicago mailing list