Opened 15 years ago

Last modified 13 years ago

#9935 closed

When used with Oracle XE, admin page throws UnicodeEncodeError — at Version 1

Reported by: jamesli Owned by: nobody
Component: contrib.sessions Version: 1.0
Severity: Keywords: oracle session unicode UnicodeEncodeError
Cc: Goldan Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Karen Tracey)

I can reproduce the problem with the following environment:
Windows XP Pro
Python 2.5.2
Oracle 10g XE (Universal)
Django 1.0.2 final

(I tend to think it is a Django/Oracle combination problem, because I can't reproduce the bug with MySQL or Postgres.)

I was walking through the tutorial, during which I installed the 'admin' site. I went to http://127.0.0.1:8000/admin/ and logged in with user name and password, and then hit the following error.

UnicodeEncodeError at /admin/

'ascii' codec can't encode characters in position 0-42: ordinal not in range(128)

Request Method: 	POST
Request URL: 	http://127.0.0.1:8000/admin/
Exception Type: 	UnicodeEncodeError
Exception Value: 	

'ascii' codec can't encode characters in position 0-42: ordinal not in range(128)

Exception Location: 	C:\Python25\lib\base64.py in decodestring, line 321
Python Executable: 	C:\Python25\python.exe
Python Version: 	2.5.2
Python Path: 	['C:\\django\\mysite', 'C:\\IBMTOOLS\\utils\\support', 'C:\\IBMTOOLS\\utils\\logger', 'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs', 'C:\\Python25\\lib', 'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25', 'C:\\Python25\\lib\\site-packages']
Server time: 	Tue, 30 Dec 2008 19:42:28 -0800
Unicode error hint

The string that could not be encoded/decoded was: 䅧㥊兣噆湃汒㍣橒㉢爹坡硖汁䝕㉤礹㉡歖兣穎浌穑呏硫坚歊浍㑍呎祉呙硉䝏㉍橙穑呚橊娊則奫婺੬zOTkx


Traceback:
Environment:

Request Method: POST
Request URL: http://127.0.0.1:8000/admin/
Django Version: 1.0.2 final
Python Version: 2.5.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.admin']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware')


Traceback:
File "C:\Python25\Lib\site-packages\django\core\handlers\base.py" in get_response
  86.                 response = callback(request, *callback_args, **callback_kwargs)
File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in root
  140.         if not self.has_permission(request):
File "C:\Python25\Lib\site-packages\django\contrib\admin\sites.py" in has_permission
  99.         return request.user.is_authenticated() and request.user.is_staff
File "C:\Python25\Lib\site-packages\django\contrib\auth\middleware.py" in __get__
  5.             request._cached_user = get_user(request)
File "C:\Python25\Lib\site-packages\django\contrib\auth\__init__.py" in get_user
  83.         user_id = request.session[SESSION_KEY]
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\base.py" in __getitem__
  46.         return self._session[key]
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\base.py" in _get_session
  172.                 self._session_cache = self.load()
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\db.py" in load
  18.             return self.decode(force_unicode(s.session_data))
File "C:\Python25\Lib\site-packages\django\contrib\sessions\backends\base.py" in decode
  93.         encoded_data = base64.decodestring(session_data)
File "C:\Python25\lib\base64.py" in decodestring
  321.     return binascii.a2b_base64(s)

Exception Type: UnicodeEncodeError at /admin/
Exception Value: 'ascii' codec can't encode characters in position 0-42: ordinal not in range(128)

Change History (1)

comment:1 by Karen Tracey, 15 years ago

Component: django.contrib.admindjango.contrib.sessions
Description: modified (diff)

(Fixed formatting.)

FWIW, this is not generally re-creatable. I've got Oracle 10g XE on a Windows box with Python 2.5.2 and have no trouble using using the admin interface with that setup. I suspect the problem may be some configuration issue but I don't know enough about Oracle or contrib.sessions to say what might be going wrong in your case.

Note: See TracTickets for help on using tickets.
Back to Top