Пример #1
0
def section(request, section_path=None, id_override=None):
    """
    A view of a section.
    """
    try:
        section = get_current_section()
    except MiddlewareNotUsed:
        lookup_from = id_override or request
        section = lookup_section(lookup_from)
    if section:
        return simple.direct_to_template(request, 
            template = "scaffold/section.html",
            extra_context = {'section': section}
        )        
    else:
        app_cache = AppCache()
        try:
            app_cache.get_app('flatpages')
            try:
                return flatpage(request, request.path_info)
            except Http404:
                pass
        except ImproperlyConfigured:
            pass
        raise Http404, "Section does not exist."
Пример #2
0
def section(request, section_path=None, id_override=None):
    """
    A view of a section.
    """
    try:
        section = get_current_section()
    except MiddlewareNotUsed:
        lookup_from = id_override or request
        section = lookup_section(lookup_from)
    if section:
        return render_to_response("scaffold/section.html", {'section': section}, context_instance=RequestContext(request))
    else:
        app_cache = AppCache()
        try:
            app_cache.get_app('flatpages')
            try:
                return flatpage(request, request.path_info)
            except Http404:
                pass
        except ImproperlyConfigured:
            pass
        raise Http404, "Section does not exist."
Пример #3
0
def section(request, section_path=None, id_override=None):
    """
    A view of a section.
    """
    try:
        section = get_current_section()
    except MiddlewareNotUsed:
        lookup_from = id_override or request
        section = lookup_section(lookup_from)
    if section:
        return simple.direct_to_template(request,
                                         template="scaffold/section.html",
                                         extra_context={'section': section})
    else:
        app_cache = AppCache()
        try:
            app_cache.get_app('flatpages')
            try:
                return flatpage(request, request.path_info)
            except Http404:
                pass
        except ImproperlyConfigured:
            pass
        raise Http404, "Section does not exist."