Looking at the documentation for pweave here, it appears to be possible to access any data generated inside a template by the calling program, by setting the returnglobals
variable.
Is it possible to do the opposite?, i.e. have the template reference a global variable in the calling script?
My use case is that I first pull some data from an SQL database, and then call pweave.pweave()
using that data to populate the template. Currently I'm doing this by writing an intermediate file and then loading this in a preamble in the template. I would like to instead just pass this in as part of the global scope. I've tried declaring a variable global
in the template, but this doesn't appear to work; I keep getting exception NameError
.