Skip to content Skip to sidebar Skip to footer

Code Blows Through Html Template And Returns To Python Directly

This question started as the question at this link I think the problem is in the template unexpected.html (further below). The python code works fine, but when the user supplies a

Solution 1:

Nowhere do you break out of the flow of execution that I can see, and the embedded HTML would be after the tests so there's no reason it wouldn't execute. The fastest solution would just be to return when you're done:

self.response.out.write(template.render(path, template_values))
return
...

In general you also have a lot of duplicated logic in that structure also: that should be consolidated and then the code could be further refactored to be more readable by making that structure more of just a dispatcher with the appropriate display logic in separate functions.

Post a Comment for "Code Blows Through Html Template And Returns To Python Directly"