]>
git.ipfire.org Git - ipfire.org.git/blob - src/web/iuse.py
8 class ImageHandler(base
.BaseHandler
):
9 def write_error(self
, status_code
, **kwargs
):
11 Select a random image from the errors directory
12 and return the content.
14 self
.set_expires(3600)
16 # Redirect to static image
17 self
.redirect(self
.static_url("img/iuse-not-found.png"))
19 def get(self
, profile_id
, image_id
):
20 when
= self
.get_argument_date("when", None)
22 profile
= self
.fireinfo
.get_profile_with_data(profile_id
, when
=when
)
24 raise tornado
.web
.HTTPError(404, "Profile '%s' was not found." % profile_id
)
26 logging
.info("Rendering new image for profile: %s" % profile_id
)
28 image_cls
= self
.iuse
.get_imagetype(image_id
)
30 raise tornado
.web
.HTTPError(404, "Image class is unknown: %s" % image_id
)
33 image
= image_cls(self
.backend
, self
, profile
).to_string()
35 # Cache generate images for 3 hours
36 self
.set_expires(3600 * 3)
38 self
.set_header("Content-Type", "image/png")