SUBJECTS
|
BROWSE
|
CAREER CENTER
|
POPULAR
|
JOIN
|
LOGIN
Business Skills
|
Soft Skills
|
Basic Literacy
|
Certifications
About
|
Help
|
Privacy
|
Terms
Search
Test your basic knowledge |
Django Middleware
Start Test
Study First
Subject
:
it-skills
Instructions:
Answer 21 questions in 15 minutes.
If you are not ready to take this test, you can
study here
.
Match each statement with the correct term.
Don't refresh. All questions and answers are randomly picked and ordered every time you load a test.
This is a study tool. The 3 wrong answers for each question are randomly chosen from answers to other questions. So, you might find at times the answers obvious, but you will see it re-enforces your understanding as you take the test each time.
1. Dictionary - Attribute - Method calls - ListIndex - It uses the first one to work using a short circuit method.
Common
GZIP
python manage.py runserver
Django dot look ups
2. Django calls this when a view raises an exception. This should return either None or an HttpResponse object. If it returns an HttpResponse object, the response will be returned to the browser. Otherwise, default exception handling kicks in.
process_request(self, request)
Common
process_response(self, request, response)
process_exception(self, request, exception)
3. To produce the 'markup' or presentation of the site.
Template tags
process_exception(self, request, exception)
Template
process_view(self, request, view_func, view_args, view_kwargs)
4. Enable the site-wide cache. If these are enabled - each Django-powered page will be cached for as long as the CACHE_MIDDLEWARE_SECONDS setting defines. See the cache documentation.
Cache
process_request(self, request)
View metadata
Common
5. 1) Forbids access to user agents in the DISALLOWED_USER_AGENTS setting - which should be a list of strings. 2) Performs URL rewriting based on the APPEND_SLASH and PREPEND_WWW settings. 3) Sends broken link notification emails to MANAGERS if SEND_BRO
Common
CSRF protection
Conditional GET
process_exception(self, request, exception)
6. This method is always called, even if the process_request() and process_view() methods of the same middleware class were skipped because an earlier middleware method returned an HttpResponse (this means that your process_response() method cannot rely
Template tags
process_response(self, request, response)
middleware processing sequence
process_view(self, request, view_func, view_args, view_kwargs)
7. During the request phases (process_request() and process_view() middleware), Django applies middleware in the order it's defined in MIDDLEWARE_CLASSES, top-down. During the response phases (process_response() and process_exception() middleware), the
middleware processing sequence
Template tags
process_view(self, request, view_func, view_args, view_kwargs)
process_response(self, request, response)
8. Tell the system to do something (ie. if statements)
process_exception(self, request, exception)
Template tags
middleware processing sequence
process_request(self, request)
9. This method is called on each request, before Django decides which view to execute.
Template tags
process_response(self, request, response)
process_request(self, request)
process_exception(self, request, exception)
10. Adds protection against Cross Site Request Forgeries by adding hidden form fields to POST forms and checking requests for the correct value.
Authentication
Message
CSRF protection
Session
11. Enables language selection based on data from the request. It customizes content for each user. See the internationalization documentation.
process_view(self, request, view_func, view_args, view_kwargs)
Session
python manage.py runserver
Locale
12. Adds the user attribute - representing the currently-logged-in user - to every incoming HttpRequest object. See Authentication in Web requests.
Authentication
process_request(self, request)
Template
View metadata
13. Handles conditional GET operations. If the response has a ETag or Last-Modified header - and the request has If-None-Match or If-Modified-Since - the response is replaced by an HttpNotModified.
process_request(self, request)
Message
Template tags
Conditional GET
14. This must return an SimpleTemplateResponse (or its subclass) object. It could alter the given response by changing response.template_name and response.context_data, or it could create and return a brand-new SimpleTemplateResponse (or its subclass) in
Authentication
Cache
View metadata
process_template_response(self, request, response)
15. Sends custom X-View HTTP headers to HEAD requests that come from IP addresses defined in the INTERNAL_IPS setting. This is used by Django's automatic documentation system.
Common
View metadata
python manage.py runserver
process_exception(self, request, exception)
16. This is called just before Django calls the view. It should return either None or an HttpResponse object. If it returns None, Django will continue processing this request, executing any other such middleware and, then, the appropriate view. If it ret
process_view(self, request, view_func, view_args, view_kwargs)
Transaction
Cache
CSRF protection
17. Binds commit and rollback to the request/response phase. If a view function runs successfully - a commit is done. If it fails with an exception - a rollback is done.
process_response(self, request, response)
Template tags
Transaction
middleware processing sequence
18. Enables session support. See the session documentation.
Locale
Common
Template
Session
19. To start the server
python manage.py runserver
Session
process_exception(self, request, exception)
Locale
20. Enables cookie- and session-based message support.
process_response(self, request, response)
process_view(self, request, view_func, view_args, view_kwargs)
Message
process_request(self, request)
21. Compresses content for browsers that understand gzip compression (all modern browsers).
process_template_response(self, request, response)
python manage.py runserver
Template
GZIP