Skip to main content

using multi template on one view_config

Project description

this is dirty implementation.

## how to use

- define selectable renderer.
- using selectable renderer as renderer factory
- using selectable renderer with view_config settings

### sample

## define selectable renderer
from pyramid_selectable_renderer import SelectableRendererSetup
from pyramid_selectable_renderer.custom import RecieveTemplatePathCandidatesDict
from pyramid_selectable_renderer.custom import SelectByRetvalLeftGen

ValidateTrueOrNot = SelectableRendererSetup(
RecieveTemplatePathCandidatesDict,
SelectByRetvalLeftGen.generate(lambda x : x),
renderer_name = "validate_true_or_not")

## in __init__.py
def includeme(config):
ValidateTrueOrNot.register_to(config) # enable to use selectable renderer

## in view.py
@view_config(route_name="sample.confirm",
renderer=ValidateTrueOrNot({True: "foo:success.pt", False: "foo:failure.pt"}))
def form_confirm_view(context, request):
form = ValidateForm(request.POST):
return form.validate(), {"form": form}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyramid_selectable_renderer-0.0.2.tar.gz (3.6 kB view details)

Uploaded Source

File details

Details for the file pyramid_selectable_renderer-0.0.2.tar.gz.

File metadata

File hashes

Hashes for pyramid_selectable_renderer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 09920229219f45a6908e755c8e924630811d3b224683cd230f01f37540298ffc
MD5 4da2e7335f9047d8a34c4feb1582b520
BLAKE2b-256 9725dc82236966332ed620bde3dce7011003af2bceaf1ed67ccc98eabd54e4cb

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page