3 Regular Python Components
Regular Python components get the default global namespace (as would
an STML component) and the component arguments in the global
namespace. The catch is that there is no <:cache:> tag
in Python, unfortunately, but this can be done by setting the global variable
named __expiration to the number of seconds past the Epoch
(12:00am 1/1/1970 UTC) at which this component will expire. This may sound
nasty, but of course there is a simple way to compute this value! In
the Date.TimeUtil module) there are two functions which mimic STML's
<:cache:> tag, convertDuration and
convertUntil.
The convertDuration function takes the same argument as the
duration argument to the <:cache:> tag as a string. So
to say your component should cache for five minutes, you'd say:
import Date.TimeUtil
__expiration = Date.TimeUtil.convertDuration("5m")
The convertUntil function takes the same argument as the
until argument to the <:cache:> tag.
Producing output works the same as in top-level python components.