Exemplo n.º 1
0
 def __call__(self, env, start_response):
     path = env['PATH_INFO']
     if path.startswith('/expired/'):
         url = 'http://' + env['HTTP_HOST'] + path.replace('/expired/', '/')
         headers = [('location', url), ('expires', '0')]
         start_response("302 Found", headers)
         return [""]
     if path.startswith('/expires/'):
         url = 'http://' + env['HTTP_HOST'] + path.replace('/expires/', '/')
         expires = time.time() + (100 * 24 * 60 * 60)
         headers = [('location', url), ('expires', httpc.to_http_time(expires))]
         start_response("302 Found", headers)
         return [""]
     return super(Site302, self).__call__(env, start_response)
Exemplo n.º 2
0
 def __call__(self, env, start_response):
     path = env['PATH_INFO']
     if path.startswith('/expired/'):
         url = 'http://' + env['HTTP_HOST'] + path.replace('/expired/', '/')
         headers = [('location', url), ('expires', '0')]
         start_response("302 Found", headers)
         return [""]
     if path.startswith('/expires/'):
         url = 'http://' + env['HTTP_HOST'] + path.replace('/expires/', '/')
         expires = time.time() + (100 * 24 * 60 * 60)
         headers = [('location', url),
                    ('expires', httpc.to_http_time(expires))]
         start_response("302 Found", headers)
         return [""]
     return super(Site302, self).__call__(env, start_response)
Exemplo n.º 3
0
 def test_to_http_time(self):
     self.assertEqual(self.rfc1123_time,
                      httpc.to_http_time(self.secs_since_epoch))
Exemplo n.º 4
0
 def test_to_http_time(self):
     self.assertEqual(self.rfc1123_time, httpc.to_http_time(self.secs_since_epoch))