David,
A while ago I had a serialization error that may be relevant to your
situation. Parts of the request object related to mod_wsgi were not
serializable. Below is how I handled it (this is a views.py def).
-Birkin
[start]
def variables( request, SSL=None ):
from django.utils import simplejson
import copy
# get rid of dictionary items not serializable
new_dict = copy.copy(request.META)
new_dict.pop('wsgi.errors')
new_dict.pop('wsgi.file_wrapper')
new_dict.pop('wsgi.input')
# now go ahead and serialize
data = simplejson.dumps( new_dict, sort_keys=True, indent=2 )
return HttpResponse( data, mimetype='text/javascript' )
# end def variables()
[end]
On Feb 13, 10:04 pm, DavidMck <[email protected]> wrote:
> I've given up. There seems to be an issue with pickling some objects
> when you're using mod_wsgi - rather than using xlrd, I just attempted
> to add the uploaded file (small file held in memory) to the session
> data. The error log was essentially the same, but complaining about an
> attempt to pickle a CStringIO object or something instead...
>
> So instead, I'm writing the file to a known disk location and then
> loading it back again on the view page, instead of holding it in
> session memory. It's dirty and it isn't scalable, but it works for
> me :D
>
> Very strange how this all 'just works' when you use the built in dev
> server...
>
> David
>
> On Feb 14, 12:50 pm, DavidMck <[email protected]> wrote:
>
> > Hmm:
>
> > My relevant codes seems to be:
>
> > @login_required
> > def upload(request):
> > if request.method == "POST":
> > form = ExcelUploadForm(request.POST, request.FILES)
> > if form.is_valid():
> > request.session['sheet'] = form.cleaned_data["excelfile"]
>
> > If I put something boring into the session (like a string, instead of
> > the form.cleaned_data item), the problem goes away. If I leave that
> > last line as it is, it comes back...
>
> > David
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.