Are you sure have the list() cast in the deployed version of the code? 
Trying to serialize a ValuesListQuerySet directly would give the error you 
mention since repr() of a ValuesListQuerySet looks like a list.

On Tuesday, November 19, 2013 12:28:11 PM UTC-5, Lee Hinde wrote:
>
> I have an app I'm moving from local dev (mac, python 2.7.2, django 1.5.4) 
> to WebFaction (python 2.7.5.
>
> I'm storing record ids like so:
>
> section_ids = list(sections.values_list('id', flat=True))
> request.session['query.section_ids.last'] = section_ids
>
>
> works fine locally and fails on WF with:
>
> (as an example)
>
> [10892L, 10891L] is not JSON serializable
>
>
> This is the traceback...
>
> File 
> "/home/leedhinde/webapps/myapp/lib/python2.7/django/core/handlers/base.py" 
> in get_response
>   187.                 response = middleware_method(request, response)
> File 
> "/home/leedhinde/webapps/myapp/lib/python2.7/django/contrib/sessions/middleware.py"
>  
> in process_response
>   38.                     request.session.save()
> File 
> "/home/leedhinde/webapps/myapp/lib/python2.7/django/contrib/sessions/backends/db.py"
>  
> in save
>   51.             
> session_data=self.encode(self._get_session(no_load=must_create)),
> File 
> "/home/leedhinde/webapps/myapp/lib/python2.7/django/contrib/sessions/backends/base.py"
>  
> in encode
>   84.         serialized = self.serializer().dumps(session_dict)
> File "/home/leedhinde/webapps/myapp/lib/python2.7/django/core/signing.py" 
> in dumps
>   100.         return json.dumps(obj, separators=(',', 
> ':')).encode('latin-1')
> File "/usr/local/lib/python2.7/json/__init__.py" in dumps
>   250.         sort_keys=sort_keys, **kw).encode(obj)
> File "/usr/local/lib/python2.7/json/encoder.py" in encode
>    207.         chunks = self.iterencode(o, _one_shot=True)
> File "/usr/local/lib/python2.7/json/encoder.py" in iterencode
>   270.         return _iterencode(o, 0)
> File "/usr/local/lib/python2.7/json/encoder.py" in default
>   184.         raise TypeError(repr(o) + " is not JSON serializable")
>
>
> I'm not clear why this wouldn't work. I also haven't figured out testing 
> session updating in the shell for simpler testing.
>
> Any pointers would be appreciated.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a07f86c4-f9e7-4549-b1ed-1e26384c72dd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to