john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

open local file

# -*- coding: utf-8 -*-
import os
import webapp2
from lib.utility import jinja_environment
import logging


class BlogHandler( webapp2.RequestHandler ):

    def get( self ):
        try:
            f = open(os.path.dirname(__file__) + '/BlogHandler.py' )
            content = f.read()
            f.close()
        except Exception:
            content = 'not found'

        template = jinja_environment.get_template( 'templates/blogentry.html' )
        template_values = { 'title': 'Blog',
                            'body': content
        }
        self.response.write( template.render( template_values ) )

  • « Email postfix sendmail email command line with attachments
  • Array return subdirs »

Published

Dec 20, 2013

Category

python-appengine

~41 words

Tags

  • appengine 18
  • file 92
  • local 4
  • open 6
  • python 180