def example_view(language):
	try:
		return render_with_template(get_context_with_rendered_content(
			language=language,
			page_or_post_type='00X-my-extended-page',
			additional_context={
				"my_additional_tag": "hello world!",
				"my_example_list": [{"value": "one"}, {"value": "two"}, {"value": "three"}]
			}
		))
	except NotAllowedError:
		abort(403)
	except UsageError as e:
		abort(500, {'message': str(e)})
	except NotFoundError:
		abort(404)
Пример #2
0
def page_view(pagename, language, post_id):
    try:
        return render_with_template(
            get_context_with_rendered_content(language=language,
                                              page_or_post_type=pagename,
                                              post_id=post_id))
    except NotAllowedError:
        abort(403)
    except UsageError as e:
        abort(500, {'message': str(e)})
    except NotFoundError as e:
        if not pagename or not language \
        or (pagename == 'index') \
        or (post_id == None and str(e) != get_page_path(pagename, language)) \
        or (post_id and str(e) != get_post_path(pagename, language, post_id)):
            abort(500, {'message': 'sorry, %s could not be found' % (str(e))})
        elif pagename == get_content_config().get('default_pagename', 'index'):
            abort(404)
        else:
            return redirect(url_for('page_view', language=language))
    raise Exception("Well that's embarassing - this should never happen.")
Пример #3
0
def page_view(pagename, language, post_id):
	try:
		return render_with_template(get_context_with_rendered_content(
			language=language,
			page_or_post_type=pagename,
			post_id=post_id
		))
	except NotAllowedError:
		abort(403)
	except UsageError as e:
		abort(500, {'message': str(e)})
	except NotFoundError as e:
		if not pagename or not language \
		or (pagename == 'index') \
		or (post_id == None and str(e) != get_page_path(pagename, language)) \
		or (post_id and str(e) != get_post_path(pagename, language, post_id)):
			abort(500, {'message': 'sorry, %s could not be found' %(str(e))})
		elif pagename == get_content_config().get('default_pagename', 'index'):
			abort(404)
		else:
			return redirect(url_for('page_view', language=language))
	raise Exception("Well that's embarassing - this should never happen.")
Пример #4
0
def example_view(language):
    try:
        return render_with_template(
            get_context_with_rendered_content(
                language=language,
                page_or_post_type='00X-my-extended-page',
                additional_context={
                    "my_additional_tag":
                    "hello world!",
                    "my_example_list": [{
                        "value": "one"
                    }, {
                        "value": "two"
                    }, {
                        "value": "three"
                    }]
                }))
    except NotAllowedError:
        abort(403)
    except UsageError as e:
        abort(500, {'message': str(e)})
    except NotFoundError:
        abort(404)