Tayra

Template. Script. Distribute

pycode – Python code blocks

Plugin implements filter-block with syntax :py:.

Module contents

class tayra.filterblocks.pycode.FilterBlockPy(pa, *args, **kwargs)[source]

Bases: pluggdapps.plugin.Plugin

Handle python code blocks.

Follows indentation rules as defined by python language. To maintain consistency, it is better to indent the entire python code block by 2 spaces. Each line will be interpreted as a python statement and substituted as is while compiling them into an intermediate .py text.

  • If filter block is defined inside @def or @interface definition, then the filter block will inherit the same local scope and context as applicable to the function/interface definition.
  • Otherwise, it will be considered as local to the implicitly defined body() function.
  • To define python code blocks that are global to entire template module, define them outside template tags.
1
2
3
4
<div>
  :py:
    print( "hello world" )
  :py:

Table Of Contents

Related Topics

This Page