Skip to content

Exiting/Returning Early from a Template #236

Closed
@sqlalchemy-bot

Description

@sqlalchemy-bot

Migrated issue, originally created by Cody Taylor (@CodeMan99)

The documentation for Returning early from a template should suggest return an empty string. Otherwise python returns None and that may appear in your rendered template.

We should also consider adding a constant to represent exiting a template for two reasons.

  1. Seeing return in the middle of a block of text can be very confusing since its normal syntax only holds meaning within a function or method.
  2. Would ensure that the suggestion of returning an empty string allows holds true. The first time I saw None in my rendered template I was really confused.

I would be more than willing to implement this change, but I would not know where to add the suggested constant.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions