Hello, I probably posted this email to wrong list. But just for the sake of other people running into this problem & googling for a solution I'll post it anyway.
The fact that I got back an array had to do with MySQL's collation settings, I had it set to 'utf8_bin' when I got the errors, changing it to 'latin1_general_ci' fixed the problem. Simon de Haan Eight Media Simon de Haan wrote: >Hello django-developers, > >I'm running into some very strange behaviour when using MySQL as the DB. >This is the first time i'm using MySQL for Django, other projects have >been Postgres based. > >Right after I log into the admin I get a strange error in >django.models.core.get_decoded(), for some reason self.session_data >contains an array instead of a string. The array is array('c', >'KGRwMQpTJ19hdXRoX3VzZXJfaWQnCnAyCkkxCnMuMWM3YTZkMWI0OTRmMmM2Y2E0MmFlMGRjZjJk\nZjVjNTI=\n') > >The error is > >TypeError at /admin/ >a2b_base64() argument 1 must be string or read-only character buffer, >not array.array >Request Method: POST >Request URL: http://localhost:8080/admin/ >Exception Type: TypeError >Exception Value: a2b_base64() argument 1 must be string or read-only >character buffer, not array.array >Exception Location: /usr/lib/python2.4/base64.py in decodestring, >line 316 > >I've test this behaviour in the shell and for Postgres I get: > >[EMAIL PROTECTED] myproject]# python manage.py shell >Python 2.3.4 (#1, Feb 2 2005, 12:11:53) >[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2 >Type "help", "copyright", "credits" or "license" for more information. >(InteractiveConsole) > >>> from django.models.core import sessions > >>> s = sessions.get_object(pk='7301a18de6eee75f89719dad6a7531b6') > >>> s.session_data >*'KGRwMQpTJ19hdXRoX3VzZXJfaWQnCnAyCkkxCnMuMTMzODk2NWQzNTQ4NzYxN2I0NjMwNzY5NmI0\nODUzMTY=\n'* > >>> > >This is perfect... > >But on MySQL i get the following: > >[EMAIL PROTECTED] myproject]# python manage.py shell >Python 2.4.1 (#1, May 16 2005, 15:19:29) >[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2 >Type "help", "copyright", "credits" or "license" for more information. >(InteractiveConsole) > >>> from django.models.core import sessions > >>> s = sessions.get_object(pk='14cb08f0a4fa0a237ca9ba9a40a93dc1') > >>> s.session_data >*array('c', >'KGRwMQpTJ19hdXRoX3VzZXJfaWQnCnAyCkkxCnMuMWM3YTZkMWI0OTRmMmM2Y2E0MmFl >MGRjZjJk\nZjVjNTI=\n')* > >>> > >Which is bad, and base64.decodestring() trips over this because it is >expecting a string. > >If i edit the line in get_decoded() to: > >*encoded_data = base64.decodestring(self.session_data.tostring())* > >it works fine, but that sorta feels like a monkey patch and doesn't fix >the problem behind this problem. > >I'm looking into it as to why this is happening but I was wondering if >other people are running into this problem too? >I am using Mysql 4.1.14 and django svn version. > >Any help & suggestions appreciated. > >Simon de Haan >Eight Media >http://www.eight.nl/ > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---