Basically, what I'm trying to do is to render os.environ
in a template in google app engine. I believe the technology is (or is adapted from) the Django template engine version 0.96 (but correct me if I'm wrong).
I found this question suggesting that you could do:
{{ for key, value in environ}}
But when I try that, I get an error saying:
'for' statements with five words should end in 'reversed': for key, value in environ
I guess that question was concerning another version of Django?
By the way, the value of environ
is set to os.environ.items()
before rendering the template.
Anyway, I came up a key_value_pair class that I could use instead:
class key_value_pair:
def __init__(self, key, value):
self.key = key
self.value = value
def make_kvp(key, iter):
return key_value_pair(key, iter[key])
make_kvp
is small "factory" method that I later use to set the environ
template value like this:
map(lambda x : make_kvp(x, os.environ), os.environ)
When doing that everything works just fine, but since I'm a total newbie to the technologies in play here, I just wanted to make sure that I'm not overseeing some obvious simpler solution.
Thanks in advance for any input.