Did I find the right examples for you? yes no

All Samples(2)  |  Call(0)  |  Derive(0)  |  Import(2)

        def zcms_template(func):
    def _func(context, request):
        site = context.get_site()
        if 'X-ZCMS-VHM' in request.headers:
            # ??????????, support ngix
            path_info = request.environ['PATH_INFO'].split('/', 2)
            if len(path_info) > 2:
                request.environ['HTTP_X_VHM_ROOT'] = '/' + site.__name__
                request.environ['PATH_INFO'] = '/%s' % path_info[2]

        content = func(context, request)
        if type(content) is tuple:  # index page may change context
            context, content = content
        if type(content) is not unicode:
            content = content.decode('utf-8')

        # ???????????
        theme_base = site.metadata.get('theme_base', '')
        kw = {
        'site_title': site.title,
        'site_description': site.metadata.get('description', ''),
        'title': context.title,
        'description': context.metadata.get('description', ''),
        'nav': render_sections(site, context, request),
        'base': context.url(request),
        'content': content,
        'left': context.render_slots('left', request),
        'right': context.render_slots('right', request),
        'upper': context.render_slots('upper', request),
        'theme_base': theme_base,
        }

        theme_default = site.metadata.get('theme', 'default.html')
        theme = context.metadata.get('theme', theme_default)
        if theme_base.startswith('/'):
            theme_base = 'http://127.0.0.1' + theme_base
        template = get_theme_template(theme_base + '/' + theme)
        output = template.substitute(kw).encode('utf8')
        return Response(output, headerlist=[
                ('Content-length', str(len(output))),
                ('Content-type', 'text/html; charset=UTF-8')
	    ])
    return _func
        


src/z/c/zcms-0.6.4/zcms/blog_views.py   zcms(Download)
from models import Page 
from webhelpers import paginate
from utils import getDisplayTime, zcms_template
from datetime import datetime
 

src/z/c/zcms-0.6.4/zcms/views.py   zcms(Download)
from pyramid.response import Response
 
from utils import zcms_template, _templates_cache
from models import Folder, Page, Image, File
import tempfile