Code reference › domain › mail

class

TrustedPlainMailTextPlaceholder

pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

Trusted, plain-string placeholder. Value is inserted verbatim in plain mode and HTML-escaped (but not markdown-escaped) in HTML mode.

Inherited attributes 1
account_requiredFalseBaseMailTextPlaceholder

Properties 4

Defined here

explanationsource

on pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

@property
def explanation(self):
    return self._explanation or ""

on pretalx.mail.domain.placeholders.BaseMailTextPlaceholder source

@property
def explanation(self):
    return ""
identifiersource

on pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

@property
def identifier(self):
    return self._identifier

on pretalx.mail.domain.placeholders.BaseMailTextPlaceholder source

Unique key the placeholder is referenced by in templates.

@property
def identifier(self):
    """Unique key the placeholder is referenced by in templates."""
    raise NotImplementedError
is_visiblesource

on pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

@property
def is_visible(self):
    return self._is_visible

on pretalx.mail.domain.placeholders.BaseMailTextPlaceholder source

Set False to hide from the placeholder picker (e.g. aliases).

@property
def is_visible(self):
    """Set ``False`` to hide from the placeholder picker (e.g. aliases)."""
    return True
required_contextsource

on pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

@property
def required_context(self):
    return self._args

on pretalx.mail.domain.placeholders.BaseMailTextPlaceholder source

Keys this placeholder needs in the render context.

@property
def required_context(self):
    """Keys this placeholder needs in the render context."""
    return ["event"]

Methods 5

Defined here

render(context)sourceReturn the rendered value given a context dict.

on pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

def render(self, context):
    return self._func(**{key: context[key] for key in self._args})

on pretalx.mail.domain.placeholders.BaseMailTextPlaceholder source

Return the rendered value given a context dict.

def render(self, context):
    """Return the rendered value given a context dict."""
    raise NotImplementedError
render_sample(event)sourceReturn a preview value that depends only on event.

on pretalx.mail.domain.placeholders.TrustedPlainMailTextPlaceholder source

def render_sample(self, event):
    if callable(self._sample):
        return self._sample(event)
    return self._sample

on pretalx.mail.domain.placeholders.BaseMailTextPlaceholder source

Return a preview value that depends only on event.

def render_sample(self, event):
    """Return a preview value that depends only on ``event``."""
    raise NotImplementedError
__init__(identifier, args, func, sample, explanation=None, is_visible=True)sourceInitialize self.

See help(type(self)) for accurate signature.

def __init__(
    self, identifier, args, func, sample, explanation=None, is_visible=True
):
    self._identifier = identifier
    self._args = args
    self._func = func
    self._sample = sample
    self._explanation = explanation
    self._is_visible = is_visible
__repr__()sourceReturn repr(self).
def __repr__(self):
    return f"TrustedPlainMailTextPlaceholder({self._identifier})"

From BaseMailTextPlaceholder pretalx.mail.domain.placeholders

render_sample_for_preview(event)sourceShape the sample like render's output so the preview pipeline matches delivery.
def render_sample_for_preview(self, event):
    """Shape the sample like :meth:`render`'s output so the preview
    pipeline matches delivery."""
    return self.render_sample(event)