Omg that was it! I just named it wrong.

Thank you SO MUCH- I copied and pasted that line from somewhere else,
and didn't change variable name (terribly stupid mistake).

Also you are correct, I do have context as a function in that same
file- not a very informative error!

In any case- thank you again, and for your quick response-

Clea

On Apr 8, 9:22 am, Tom Evans <tevans...@googlemail.com> wrote:
> On Thu, Apr 8, 2010 at 2:00 PM, clea <clea.barn...@gmail.com> wrote:
> > Hello-
> > I am having the following problem:
> > I have a normal form within an html page (here is a shortened
> > version):
> > <form action="context_form/" method="post" class="contextForm">
> > <select name="clinical_setting" id="clinical_setting">
> > <option value="-1" id="-1" selected="true">------------</option>
> > {% for setting in context.form_options.clinical_settings %}
> > <option value="{{ setting.value }}">{{ setting.label }}</option>
> > {% endfor %}
> > </select>
> > <input type="submit" name="submit" id="normal_submit_button"
> > value="Next"/>
> > </form>
>
> > On submit, I have:
> > def context_form(request):
> >        if request.method == 'POST':
> >                user_context = createUserContextFromSubmittedForm(request)
> >                if user_context is not None:
> >                        user_context.start_common = True
> >                        user_context.end_common = False
> >                        user_context.start_chosen = False
> >                        user_context.end_chosen = False
> >                        sessionid = request.session.session_key
> >                        request.session.__setitem__("context", context)
> >                else:
> >                        print "-0--- ERROR"
> >                print "returning"
> >                #return render_to_response('asdfasdf.html')
> >                return HttpResponse("", mimetype='application/javascript')
>
> > The function gets to the return (because it prints "returning"), and
> > even when I take away the sessionid and request.session part, I still
> > get the following error:
> > PicklingError: Can't pickle <type 'function'>: attribute lookup
> > __builtin__.function failed
>
> > any ideas?
>
> > Thanks!
> > Clea
>
> What is "context"? Did you mean to use "user_context" rather than
> "context" when you are setting it in the session?
>
> I think you have a function somewhere called context, and you are
> trying to store that in the session rather than your constructed
> user_context.
>
> If you want more than that, provide the full traceback.
>
> Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to