Skip to content

Instantly share code, notes, and snippets.

@andrewxhill
Created May 15, 2011 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewxhill/973618 to your computer and use it in GitHub Desktop.
Save andrewxhill/973618 to your computer and use it in GitHub Desktop.
class Javascript(webapp.RequestHandler):
def get(self,file):
ref = self.request.referer
if ref == "" or 'javascript/' in ref:
jspath = 'source'
else:
jspath = 'mini'
self.response.headers['Content-Type'] = "application/json"
self.response.out.write(template.render('%s/%s.js' % (jspath,file), {}))
def post(self,file):
self.response.headers['Content-Type'] = "application/json"
self.response.out.write(template.render('mini/%s.js' % file, {}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment