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

  • Home
  • SEARCH
  • 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 635155
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:22:25+00:00 2026-05-13T20:22:25+00:00

def list_ajax(reqest): #q = request.GET.get(‘q’,None) #get all where var = q. return … list_ajax

  • 0
def list_ajax(reqest):
    #q = request.GET.get('q',None)
    #get all where var = q.
    return ...
list_ajax = condition(etag_func=list_ajax)(list_ajax)

As you can see, I’m trying to return a 304 to the client if the result is the same. But, I am getting this Django error, why?:

Traceback:
File "/usr/local/lib/python2.6/dist-packages/django/core/handlers/base.py" in get_response
  92.                 response = callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.6/dist-packages/django/views/decorators/http.py" in inner
  130.                 response['ETag'] = quote_etag(res_etag)
File "/usr/local/lib/python2.6/dist-packages/django/utils/http.py" in quote_etag
  118.     return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')

Exception Type: AttributeError at /list/ajax/
Exception Value: 'HttpResponse' object has no attribute 'replace'

Edit: I did this:

def etag_generate(p):
    thestring =  cPickle.dumps(p)
    return thestring

@etag(etag_generate)
def list_ajax(request):
    ...
    etag_generate(mydictresults)
    return render_to_response("list.html",mydictresults)

I’m turning all the results into a String, hoping that a hash could be generated from this dictionary. But, it seems like the @etag won’t let me generate the cPickle. Error is:

Exception Type: TypeError at /list/ajax/ 
Exception Value: can't pickle file objects
  • 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-05-13T20:22:25+00:00Added an answer on May 13, 2026 at 8:22 pm

    Fixed.

    Passed the request in.

    def list_ajax_etag(request):
        return str(request.GET.get('l',''))+str(request.GET.get('a',''))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following classes/traits in Scala trait Write[-T] { def add(elem : T);
I want to develop an ajax functionality for commenting posts in my website. I've
I am a newbie trying to make a webservice that talks JSON. I have
I have 3 django models (simplified for this example): class Fighter (models.Model): name =
I'm developing a Grails (Version 1.3.3) Web-Application using the Grails Spring-Security Plugin, Spring-Security-Core-1.0.1 (which,
Suppose I have a Ruby ERB template named my_template.html.erb , and it contains the
I'm writing test cases for a project which still uses the Acegi plugin (not
I'm trying to write Junit4 test cases for my Groovy code. The Junit 4
I am working on creating some grails domain objects dynamically and then adding them
I am trying to create a simple CRUD with ModelForm. It works fine except

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.