wheezy.web / demos / template / src / public / web / views.py


from datetime import timedelta

from wheezy.http import response_cache
from wheezy.http.transforms import gzip_transform
from wheezy.http.transforms import response_transforms
from wheezy.web.handlers import file_handler
from wheezy.web.handlers import template_handler

from public.web.profile import public_cache_profile
from public.web.profile import static_cache_profile

wraps_handler = lambda p: lambda h: response_cache(p)(

extra = {
    'translation_name': 'public'

w = wraps_handler(public_cache_profile)
home = w(template_handler('public/home.html', **extra))
about = w(template_handler('public/about.html', **extra))

# cached by nginx
http400 = template_handler('public/http400.html', status_code=400, **extra)
http403 = template_handler('public/http403.html', status_code=403, **extra)
http404 = template_handler('public/http404.html', status_code=404, **extra)
http500 = template_handler('public/http500.html', status_code=500, **extra)

w = wraps_handler(static_cache_profile)
static_file = w(file_handler(root='content/static/', age=timedelta(hours=1)))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.