Log in
appy.pod Alternate expressions

POD expressions, as previously documented, are defined by misusing LibreOffice fields or track-changed text.

For ODS templates, it is easy: there is a single way to encode POD expressions. Any cellĀ containing an expression of theĀ form:

="<python_expression>"

will be interpreted as a POD expression.

For ODT, as already stated, the standard way is to misuseĀ fields of type "Conditional text". All examples in this site use such fields. However, by default, 2 other "expression holders" are also activated:

  • track-changed text;
  • text input fields.

Track-changed text was the initial expression holder and is activated for backward compatibility,Ā but you are discouraged from using it for writing new POD templates. That being said, being activated by default, you must understand that it may have an impact in your POD templates: anything you write as track-changed text willĀ be interpreted by POD as a POD expression. Suppose you have the following ODT template.

You could be surprised by the result, after having used this context.

from appy.model.utils import Object as O
self = O(name='Smith', firstName='John')

Every POD expression holderĀ has an identifier. The complete list is in the following table.

IdentifierPOD Expression holderActivated by default?
if Field of type "Conditional text" Yes
change Track-changed text Yes
input Fields of type "Input field" Yes
db Database record No

Defining which holders are activated is done via attribute expressionHolders passed to the Renderer. If, for example, you want to minimizeĀ interferences with LibreOffice, you may call the Renderer with:

Renderer(..., expressionsHolders=('if',), ...)

This would disable holders "change" and "input".