Code

Opened 7 years ago

Closed 7 years ago

#3424 closed (duplicate)

Admin zone breaks

Reported by: aribao@… Owned by: adrian
Component: Core (Management commands) Version: 0.95
Severity: Keywords: django, a2b_base64(), admin, mysql 5, collation
Cc: aribao@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by ubernostrum)

Hello, I'm using Debian sid, python 2.4 (and 2.5), django 0.95.1, and mysql 5. The tables created have collation utf8-bin.
When I tried to open the admin zone, I got this error:

Traceback (most recent call last):
File "/var/lib/python-support/python2.4/django/core/handlers/base.py" in get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File "/var/lib/python-support/python2.4/django/contrib/admin/views/decorators.py" in _checklogin
  49. if request.user.is_authenticated() and request.user.is_staff:
File "/var/lib/python-support/python2.4/django/contrib/auth/__init__.py" in get_user
  71. user_id = request.session[SESSION_KEY]
File "/var/lib/python-support/python2.4/django/contrib/sessions/middleware.py" in __getitem__
  18. return self._session[key]
File "/var/lib/python-support/python2.4/django/contrib/sessions/middleware.py" in _get_session
  57. self._session_cache = s.get_decoded()
File "/var/lib/python-support/python2.4/django/contrib/sessions/models.py" in get_decoded
  61. encoded_data = base64.decodestring(self.session_data)

  TypeError at /admin/
  a2b_base64() argument 1 must be string or read-only character buffer, not array.array

I solved it changing the collation of the field session_data in the django_session table from utf8-bin to latin1_general_ci.
There is a bug using utf8-bin in that field.

Thank you.

Attachments (0)

Change History (8)

comment:1 Changed 7 years ago by ubernostrum

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

(fixed traceback formatting)

comment:2 Changed 7 years ago by Simon G. <dev@…>

  • Resolution set to worksforme
  • Status changed from new to closed

I'm tentatively marking this as "worksforme" - as I'm not sure how the collation could be affecting anything (encoding yes, but collation?) I've also looked at all my django_session tables and they're all utf8 on a set up similar to yours (Sarge, MySQL5, python 2.4). I am however running the svn version and NOT 0.95

Can you provide more information about this and correct me if I'm wrong? (& do reopen it if I am).

comment:3 Changed 7 years ago by anonymous

Yesterday, I tried to do it again, with a new database, and it worked using utf-bin.
I don't know exactly where the problem is, but there was an error.
If it happen again, I'll try to post more information.
Thank you.

comment:4 Changed 7 years ago by LightLan@…

this error happens to me, too.
It is an error with the session module and not with the adminpage, since it happens with a generic view, too.
It's still in the svn-version I tried.
Switching to postgresql saved the problem for me.

comment:5 Changed 7 years ago by Simon G. <dev@…>

LightLan - which svn version were you having the problem on? there were a lot of changes recently rolled in for MySQL in [4724], which should have helped fix this.

comment:6 Changed 7 years ago by LightLan@…

I used 4703.
I'll test it with the new one, once I got some time, rolling through the tutorial atm ;)

comment:7 Changed 7 years ago by ubernostrum

  • Resolution worksforme deleted
  • Status changed from closed to reopened

I'm going to reopen #2335 and mark this as a duplicate, because an anonymous comment on that ticket has information about what causes the problem.

comment:8 Changed 7 years ago by ubernostrum

  • Resolution set to duplicate
  • Status changed from reopened to closed

Add Comment

Modify Ticket

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


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

 
Note: See TracTickets for help on using tickets.