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 8280951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:51:55+00:00 2026-06-08T09:51:55+00:00

Many times in open source codes of django python , I have seen the

  • 0

Many times in open source codes of django python , I have seen the scenario like this

if request.META and 'HTTP_REFERER' in request.META:

Similarly I have seen these two if conditions also

if request.POST and 'next' in request.POST:
if request.GET and 'next' in request.GET:

I believe that only one condition is suffice to check the if condition in these cases like

if 'HTTP_REFERER' in request.META:
if 'next' in request.POST:
if 'next' in request.GET:

So why most of the time people use the earlier once, Is it just like double checking or there are some scenarios at which the first double check conditions may be useful while the later single check conditions might fail?

  • 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-08T09:51:56+00:00Added an answer on June 8, 2026 at 9:51 am

    I’ve just grepped the whole (current git) source of django, and hadn’t found a single occurrence of all three conditionals you mentioned.

    And you are perfectly right with the one condition sufficing it as long as you can assume that all the three dictionaries are set. And looking at django code, I believe you can assume that.

    Edit: also the django documentation suggests that those dictionaries will always be set.

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

Sidebar

Related Questions

Many times I see statements like following Y.CustomApp.superclass.render.apply(this, arguments); I know how apply works.
How many times have you seen someone trying to Log the command I run
I know questions like this have been asked numerous times, but not quite this
I have a C++ code generator in Python that generates many source files. Most
Many times I see in open source code that a call to a C
Many times i run time consuming PHP scripts that echo status updates like 'batch
I have used NSSets many times in my apps, but I have never created
I have heard it many times that garbage collection in PyS60 is not up
I have used an open source code from CodeProject to read email from incoming
My question is in regard to referencing open source frameworks. There are many of

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.