Skip to content

Commit

Permalink
CSS sort of coming together; templates with inheritance.
Browse files Browse the repository at this point in the history
  • Loading branch information
skarra committed May 18, 2012
1 parent 5fa6143 commit b310435
Show file tree
Hide file tree
Showing 9 changed files with 541 additions and 275 deletions.
13 changes: 9 additions & 4 deletions prs.py
@@ -1,6 +1,6 @@
##
## Created : Mon May 14 18:10:41 IST 2012
## Last Modified : Fri May 18 06:44:04 IST 2012
## Last Modified : Fri May 18 15:14:00 IST 2012
##
## Copyright (C) 2012 Sriram Karra <karra.etc@gmail.com>
##
Expand Down Expand Up @@ -37,17 +37,22 @@
config_file = os.path.join(DIR_PATH, 'config.json')
config = config.Config(config_file)

main_template = os.path.join(DIR_PATH, 'templates', 'prs.html')

settings = {'debug': True,
'static_path': os.path.join(__file__, 'static')}

class NewPatientHandler(tornado.web.RequestHandler):
def get(self):
template = os.path.join(DIR_PATH, 'templates', 'new-patient.html')
self.render(template, title=config.get_title())

class MainHandler(tornado.web.RequestHandler):
def get(self):
self.render(main_template, title='CMC, Lajpat Bhavan')
template = os.path.join(DIR_PATH, 'templates', 'index.html')
self.render(template, title=config.get_title())

application = tornado.web.Application([
(r"/", MainHandler),
(r"/newpatient", NewPatientHandler),
(r'/static/(.*)', tornado.web.StaticFileHandler, {'path': static_path})
])

Expand Down
11 changes: 7 additions & 4 deletions src/config.py
@@ -1,6 +1,6 @@
##
## Created : Mon May 14 23:04:44 IST 2012
## Last Modified : Mon May 14 23:17:36 IST 2012
## Last Modified : Fri May 18 08:21:00 IST 2012
##
## Copyright (C) 2012 Sriram Karra <karra.etc@gmail.com>
##
Expand All @@ -22,7 +22,10 @@ def __init__ (self, confn, synct=True):
raise

stc = confi.read()
self.state = { 'state' : demjson.decode(stc)}
self.state = demjson.decode(stc)

print 'self.state: ', self.state

confi.close()

self.set_app_root(os.path.abspath(''))
Expand Down Expand Up @@ -75,10 +78,10 @@ def _update_prop (self, prop, which, val, sync=False):
##

def get_title (self):
return _get_prop('title')
return self._get_prop('title')

def get_app_root (self):
return _get_prop('app_root')
return self._get_prop('app_root')

def set_app_root (self, val):
return self._set_prop('app_root', val)
Expand Down
2 changes: 1 addition & 1 deletion src/models.py
@@ -1,6 +1,6 @@
##
## Created : Mon May 14 23:04:44 IST 2012
## Last Modified : Fri May 18 07:02:35 IST 2012
## Last Modified : Fri May 18 07:13:48 IST 2012
##
## Copyright (C) 2012 Sriram Karra <karra.etc@gmail.com>
##
Expand Down

0 comments on commit b310435

Please sign in to comment.