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 ReceiveTemplatePathCandidatesDict
from pyramid_selectable_renderer.custom import SelectByRetvalLeftGen

ValidateTrueOrNot = SelectableRendererSetup(
ReceiveTemplatePathCandidatesDict,
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.4.tar.gz (4.0 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for pyramid_selectable_renderer-0.0.4.tar.gz
Algorithm Hash digest
SHA256 8f18a5e163adb725fdc54659a547cd58a23c15ab79305573b011c20d15af7e76
MD5 42c063a39b873af63959cf341578d31b
BLAKE2b-256 424996a5e4cebed89bb40b9a1dbdd8ffc30e4e894e9ca21966646cb4df0fba52

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