Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
pyramid.pdf
Скачиваний:
10
Добавлен:
24.03.2015
Размер:
3.82 Mб
Скачать

CHAPTER

FORTYTWO

PYRAMID.CHAMELEON_TEXT

get_template(path)

Return the underyling object representing a Chameleon text template using the template implied by the path argument. The path argument may be a package-relative path, an absolute path, or a asset specification.

latex-warning.png

This API is deprecated in Pyramid 1.0. Use the implementation() method of a template renderer retrieved via pyramid.renderers.get_renderer() instead.

render_template(path, **kw)

Render a Chameleon text template using the template implied by the path argument. The path argument may be a package-relative path, an absolute path, or a asset specification. The arguments in *kw are passed as top-level names to the template, and so may be used within the template itself. Returns a string.

latex-warning.png

This API is deprecated in Pyramid 1.0. Use pyramid.renderers.render() instead.

515

42. PYRAMID.CHAMELEON_TEXT

render_template_to_response(path, **kw)

Render a Chameleon text template using the template implied by the path argument. The path argument may be a package-relative path, an absolute path, or a asset specification. The arguments in *kw are passed as top-level names to the template, and so may be used within the template itself. Returns a Response object with the body as the template result.

latex-warning.png

This API is deprecated in Pyramid 1.0. Use pyramid.renderers.render_to_response() instead.

These APIs will will work against template files which contain simple ${Genshi} - style replacement markers.

The API of pyramid.chameleon_text is identical to that of pyramid.chameleon_zpt; only its import location is different. If you need to import an API functions from this module as well as the pyramid.chameleon_zpt module within the same view file, use the as feature of the Python import statement, e.g.:

1

2

from pyramid.chameleon_zpt import render_template as zpt_render from pyramid.chameleon_text import render_template as text_render

516

CHAPTER

FORTYTHREE

PYRAMID.CHAMELEON_ZPT

get_template(path)

Return the underyling object representing a Chameleon ZPT template using the template implied by the path argument. The path argument may be a package-relative path, an absolute path, or a asset specification.

latex-warning.png

This API is deprecated in Pyramid 1.0. Use the implementation() method of a template renderer retrieved via pyramid.renderers.get_renderer() instead.

render_template(path, **kw)

Render a Chameleon ZPT template using the template implied by the path argument. The path argument may be a package-relative path, an absolute path, or a asset specification. The arguments in *kw are passed as top-level names to the template, and so may be used within the template itself. Returns a string.

latex-warning.png

This API is deprecated in Pyramid 1.0. Use pyramid.renderers.render() instead.

517

43. PYRAMID.CHAMELEON_ZPT

render_template_to_response(path, **kw)

Render a Chameleon ZPT template using the template implied by the path argument. The path argument may be a package-relative path, an absolute path, or a asset specification. The arguments in *kw are passed as top-level names to the template, and so may be used within the template itself. Returns a Response object with the body as the template result.

latex-warning.png

This API is deprecated in Pyramid 1.0. Use pyramid.renderers.render_to_response() instead.

These APIs will work against files which supply template text which matches the ZPT specification.

The API of pyramid.chameleon_zpt is identical to that of pyramid.chameleon_text; only its import location is different. If you need to import an API functions from this module as well as the pyramid.chameleon_text module within the same view file, use the as feature of the Python import statement, e.g.:

1

2

from pyramid.chameleon_zpt import render_template as zpt_render from pyramid.chameleon_text import render_template as text_render

518

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]