Recently I've spotted a very disturbing issue.
I've got the following python code:
for cat in cats:
cat.pages = ['apple', 'table', 'computer']
template_values = {
'cats': cats
}
path = os.path.join(os.path.dirname(__file__), 'templates/index.html')
self.response.out.write(template.render(path, template_values))
The index.html django template looks like this:
{% for cat in cats %}
<div>{{ forloop.counter }}</div>
<div>name: {{ cat.cat_name }}</div>
<div>pages: {{ cat.pages|length }}<br>
{% endfor %}
When I'm running the code above locally with the GAE SDK, I've got the following example results:
1.
name: sample1
pages: 3
2.
name: sample2
pages: 3
etc. I can even build a nested loop since I can access cat.pages inside the loop. However, when I upload this code to the AppEngine, I'll get the following results:
1.
name: sample1
pages: 0
2.
name: sample2
pages: 0
And I can't even access the cat.pages variable at all. What's wrong with my code? Or is this a bug? It works locally as it's expected, but produces this strange result after deploying to GAE servers. Any help is appreciated.