Google App Engine REST middleware

I have been trying to get this to work for quite some time now but with no luck and now I’m stuck, I simply can’t get my mind around this. I know that the path I have chosen may not be the easiest but I still believe it’s the most elegant one: I want to add a middleware to my Python based Google App Engine application, enabling me to use the _method=put in order to make my app RESTful. Continue reading

Google Appengine rendering templates

import os
from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
# Utility function for rendering template files
def do_render(handler, template_file, vals = {}, template_dir = 'templates/'):
# Create full path to file
path = os.path.join(os.path.join(os.path.dirname(__file__), template_dir), template_file)
# Write out the content
handler.response.out.write(template.render(path, vals))

I’m actually not sure why I posted this small codesnippet here, but it’s from a small Google Appengine project that I have been working on.
It’s a great function for rendering templates (I think it’s the django way) using Google Appengine

Follow

Get every new post delivered to your Inbox.