Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:09:35+00:00 2026-06-04T13:09:35+00:00

I am trying to use session to pass some data from one page to

  • 0

I am trying to use session to pass some data from one page to another page.
Here is the code i wrote in ajax.py.

def save_cookie(request, query):
    request.session['query'] = query

But when i call this dajaxice function.An error will occurred. As we all know that when we try to use dajaxice in html page, the error msg always is “sth goes wrong”.
I tried to debug save_cookie, but the mock request object i created has no session attr. However, if i do request.session=”blah”, it worked. If I directly use save_cookie(request,query). It will pop up the error msg that request object has no attr seesion…

The code is right straight forward. I didn’t see any mistake in it. Does anyone know the cause?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:09:37+00:00Added an answer on June 4, 2026 at 1:09 pm

    Never used dajaxice / dajax so I can’t really help here. Just a few points:

    • did you enable (and properly configue) the session support ? https://docs.djangoproject.com/en/1.3/topics/http/sessions/

    • you can use the logging module (or a plain “print” statement but then you won’t have the whole traceback) to trace the exception, ie :

      def save_cookie(request, query):
      try:
      request.session[‘query’] = query
      except Exception, e:
      print e
      raise

    The output of the print statement should now appear in the shell you started the dev server from (assuming you’re working with the dev server… you ARE workin with the dev server, aren’t you ?)

    • still using the dev server, you can use pdb to switch to interactive debugging:

      def save_cookie(request, query):
      import pdb; pdb.set_trace()
      request.session[‘query’] = query

    then try to access the url in your browser, switch back to your shell and you’re in a pdb session where you can inspect the request and (if there’s one) request.session object etc.

    NB : don’t do this if running behind Apache or any other web server – only with the builtin dev server.

    • “request.session=’blah'” will create the “session” attribute on the “request” object if it doesn’t exist (and possibly replace the real “session” object if it already existed), so it’s neither a valid test nor something sensible to do

    My 2 cents…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to use the current session of a php web page from
I am trying to use the following code to pass information to another site
I am using sessions to pass user information from one page to another. However,
I'm trying to use redirects and sessions in Sinatra to pass some data around
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
I am trying to pass data between two pages using Session State in ASP.NET.
New to SPA MVC4, trying to pass a session variable to LinqToEntitiesDataController from the
I am trying to use PHP session without using cookies. I have enabled session.use_trans_sid
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
Trying to use GnuPG with Delphi (Win32). I need to sign some file with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.