Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1267

Show
Ignore:
Timestamp:
08/22/06 13:06:40
Author:
fumanchu
Message:

Fix to etags when 412 has already been raised.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/lib/cptools.py

    r1261 r1267  
    2828        conditions = [str(x) for x in conditions] 
    2929        if conditions and not (conditions == ["*"] or etag in conditions): 
    30             if (status >= 200 and status < 299) or status == 412
     30            if status >= 200 and status < 299
    3131                raise cherrypy.HTTPError(412) 
    3232         
     
    3434        conditions = [str(x) for x in conditions] 
    3535        if conditions == ["*"] or etag in conditions: 
    36             if (status >= 200 and status < 299) or status == 304
     36            if status >= 200 and status < 299
    3737                if cherrypy.request.method in ("GET", "HEAD"): 
    3838                    raise cherrypy.HTTPRedirect([], 304) 
  • trunk/cherrypy/test/test_etags.py

    r1148 r1267  
    1010            return "Oh wah ta goo Siam." 
    1111        resource.exposed = True 
     12         
     13        def fail(self): 
     14            raise cherrypy.HTTPError(412) 
     15        fail.exposed = True 
    1216     
    1317    conf = { 
    14         '/resource': { 
     18        '/': { 
    1519            'tools.etags.on': True, 
    1620            'tools.etags.autotags': True, 
     
    5761        self.getPage("/resource", headers=[('If-None-Match', "a bogus tag")]) 
    5862        self.assertStatus("200 OK") 
     63         
     64        # Test raising 412 in page handler 
     65        self.getPage("/fail", headers=[('If-Match', etag)]) 
     66        self.assertStatus(412) 
     67 
    5968 
    6069if __name__ == "__main__": 

Hosted by WebFaction

Log in as guest/cpguest to create tickets