Change environment cache key construction

Changing from a tuple of the loader ID and template name to a weakref
to the loader and the template name should avoid situations whereby
the loader has changed, yet the cached templates are returned. This
would occur if the id of the new loader matches the old. A weakref is
preferred over a direct reference so that the loader can be garbaged
collected.
2 files changed