Пример #1
0
 def _update_cache_control(self, prop_dict):
     value = serialize_cache_control(prop_dict)
     if not value:
         if 'Cache-Control' in self.headers:
             del self.headers['Cache-Control']
     else:
         self.headers['Cache-Control'] = value
Пример #2
0
 def _update_cache_control(self, prop_dict):
     value = serialize_cache_control(prop_dict)
     if not value:
         if 'Cache-Control' in self.headers:
             del self.headers['Cache-Control']
     else:
         self.headers['Cache-Control'] = value
Пример #3
0
def test_serialize_cache_control_object_with_headers():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({'header': 'a'}, 'request'))
    assert result == 'header=a'
Пример #4
0
def test_serialize_cache_control_cache_control_object():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({}, 'request'))
    assert result == ''
Пример #5
0
def test_serialize_cache_control_emptydict():
    from webob.cachecontrol import serialize_cache_control
    result = serialize_cache_control(dict())
    assert result == ''
Пример #6
0
 def _update_cache_control(self, prop_dict):
     self.environ['HTTP_CACHE_CONTROL'] = serialize_cache_control(prop_dict)
Пример #7
0
def test_serialize_cache_control_object_with_headers():
    from webob.cachecontrol import CacheControl, serialize_cache_control

    result = serialize_cache_control(CacheControl({"header": "a"}, "request"))
    assert result == "header=a"
Пример #8
0
def test_serialize_cache_control_object_with_headers():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({'header':'a'}, 'request'))
    assert result == 'header=a'
Пример #9
0
def test_serialize_cache_control_value_is_None():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({'header':None}, 'request'))
    assert result == 'header'
Пример #10
0
def test_serialize_cache_control_emptydict():
    from webob.cachecontrol import serialize_cache_control
    result = serialize_cache_control(dict())
    assert result == ''
Пример #11
0
def test_serialize_cache_control_cache_control_object():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({}, 'request'))
    assert result == ''
Пример #12
0
 def _update_cache_control(self, prop_dict):
     self.environ['HTTP_CACHE_CONTROL'] = serialize_cache_control(prop_dict)
Пример #13
0
def test_serialize_cache_control_value_needs_quote():
    from webob.cachecontrol import CacheControl, serialize_cache_control

    result = serialize_cache_control(CacheControl({"header": '""'}, "request"))
    assert result == 'header=""""'
Пример #14
0
def test_serialize_cache_control_value_is_None():
    from webob.cachecontrol import CacheControl, serialize_cache_control

    result = serialize_cache_control(CacheControl({"header": None}, "request"))
    assert result == "header"
Пример #15
0
def test_serialize_cache_control_value_is_None():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({'header': None}, 'request'))
    assert result == 'header'
Пример #16
0
def test_serialize_cache_control_value_needs_quote():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({'header':'""'}, 'request'))
    assert result == 'header=""""'
Пример #17
0
def test_serialize_cache_control_value_needs_quote():
    from webob.cachecontrol import serialize_cache_control, CacheControl
    result = serialize_cache_control(CacheControl({'header': '""'}, 'request'))
    assert result == 'header=""""'
Пример #18
0
def test_serialize_cache_control_cache_control_object():
    from webob.cachecontrol import CacheControl, serialize_cache_control

    result = serialize_cache_control(CacheControl({}, "request"))
    assert result == ""