Exemple #1
0
def test_serve_file(image_dir):
    path = static_dir + "/logos/logo-en.png"

    assert coverlib.read_file('/dev/null') == ''
    assert coverlib.read_file(path) == open(path).read()

    assert coverlib.read_file(path + ":10:20") == open(path).read()[10:10 + 20]
def test_serve_file():
    path = static_dir + "/logos/logo-en.png"
        
    assert coverlib.read_file('/dev/null') == ''
    assert coverlib.read_file(path) == open(path).read()

    assert coverlib.read_file(path + ":10:20") == open(path).read()[10:10+20] 
Exemple #3
0
 def notfound():
     if config.default_image and i.default.lower() != "false" and not is_valid_url(i.default):
         return read_file(config.default_image)
     elif is_valid_url(i.default):
         raise web.seeother(i.default)
     else:
         raise web.notfound("")
Exemple #4
0
 def notfound():
     if key in ["id", "olid"] and config.get("upstream_base_url"):
         # this is only used in development
         base = web.rstrips(config.upstream_base_url, "/")
         raise web.redirect(base + web.ctx.fullpath)
     elif config.default_image and i.default.lower(
     ) != "false" and not is_valid_url(i.default):
         return read_file(config.default_image)
     elif is_valid_url(i.default):
         raise web.seeother(i.default)
     else:
         raise web.notfound("")