Permalink
Browse files

instruction to remove a response.headers thanks niphlod

  • Loading branch information...
1 parent 703ae1c commit cff9eceaf2725218af443dfeafc2d37b98c5fb21 @mdipierro mdipierro committed Nov 15, 2012
Showing with 6 additions and 8 deletions.
  1. +1 −0 __init__.py
  2. +0 −3 controllers/appadmin.py
  3. +4 −4 controllers/default.py
  4. +1 −1 sources/29-web2py-english/04.markmin
View
@@ -0,0 +1 @@
+
View
@@ -437,6 +437,3 @@ def key_table(keys):
return dict(form=form, total=total,
ram=ram, disk=disk, object_stats=hp != False)
-
-
-
View
@@ -13,7 +13,7 @@ def splitter(x):
@cache('folders',None)
def get_folders(dummy=None):
folder = os.path.join(request.folder,'sources')
- return folder, [f for f in os.listdir(folder)
+ return folder, [f for f in os.listdir(folder)
if os.path.isdir(os.path.join(folder,f))]
FOLDER, FOLDERS = get_folders()
@@ -73,12 +73,12 @@ def truncate(x): return x[:70]+'...' if len(x)>70 else x
def index():
books = {}
- for subfolder in FOLDERS:
+ for subfolder in FOLDERS:
books[subfolder] = cache.ram('info_%s' % subfolder, lambda: get_info(subfolder), time_expire=60*60*24)
return locals()
def calc_date(now=request.utcnow.date()):
- # if you are changing sources often remove the
+ # if you are changing sources often remove the
# comment from the next 2 lines
# import datetime
# now = now + datetime.timedelta(days=1)
@@ -157,7 +157,7 @@ def reference():
raise HTTP(404)
info = dict(splitter(line)
for line in open(filename).readlines()
- if ':' in line)
+ if ':' in line)
if info['source_url']:
redirect(info['source_url'])
else:
@@ -990,7 +990,7 @@ Also notice the ``request.env.wsgi_*`` variables. They are specific to the wsgi
``response.flash``: optional parameter that may be included in the views. Normally used to notify the user about something that happened.
-``response.headers``: a ``dict`` for HTTP response headers. Web2py sets some headers by default, including "Content-Length", "Content-Type", and "X-Powered-By" (set equal to web2py). Web2py also sets the "Cache-Control", "Expires", and "Pragma" headers to prevent client-side caching, except for static file requests, for which client-side caching is enabled. The headers that web2py sets can be overwritten or removed, and new headers can be added (e.g., ``response.headers['Cache-Control'] = 'private'``).
+``response.headers``: a ``dict`` for HTTP response headers. Web2py sets some headers by default, including "Content-Length", "Content-Type", and "X-Powered-By" (set equal to web2py). Web2py also sets the "Cache-Control", "Expires", and "Pragma" headers to prevent client-side caching, except for static file requests, for which client-side caching is enabled. The headers that web2py sets can be overwritten or removed, and new headers can be added (e.g., ``response.headers['Cache-Control'] = 'private'``). You can remove a header removing its key from the response.headers dict, e.g.``del response.headers['Custom-Header']``, however web2py's default headers will be re-added just before returning the response. To avoid this behaviour, just set the header value to None, e.g. to remove the default Content-Type header, ``response.headers['Content-Type'] = None``
``response.menu``: optional parameter that may be included in the views, normally used to pass a navigation menu tree to the view. It can be rendered by the MENU helper.

0 comments on commit cff9ece

Please sign in to comment.