Skip to content
Browse files

raise web.notmodified instead of returning False to indicate notmodified

  • Loading branch information...
1 parent d7ecd8c commit e6bc8d20414fa2d0a29cec84daf4a0f466832f47 @anandology anandology committed Feb 18, 2010
Showing with 6 additions and 4 deletions.
  1. +6 −4 web/http.py
View
10 web/http.py
@@ -56,8 +56,8 @@ def modified(date=None, etag=None):
This function takes the last-modified date `date` and the ETag `etag`
and checks the headers to see if they match. If they do, it returns
- `True` and sets the response status to `304 Not Modified`. It also
- sets `Last-Modified and `ETag` output headers.
+ `True` otherwise it raises NotModified error. It also sets
+ `Last-Modified` and `ETag` output headers.
"""
try:
from __builtin__ import set
@@ -77,10 +77,12 @@ def modified(date=None, etag=None):
if date-datetime.timedelta(seconds=1) <= m:
validate = True
- if validate: web.ctx.status = '304 Not Modified'
if date: lastmodified(date)
if etag: web.header('ETag', '"' + etag + '"')
- return not validate
+ if validate:
+ raise web.notmodified()
+ else:
+ return True
def urlencode(query, doseq=0):
"""

0 comments on commit e6bc8d2

Please sign in to comment.
Something went wrong with that request. Please try again.