コード例 #1
0
 def view(self, name, data=None):
     template = self.env.get_template(name + '.html')
     data = template.render(data=data)
     return Application.get('response').sendResponse(data, '200')
コード例 #2
0
 def contact(self):
     return Application.get('response').sendResponse(
         '<h1>This is html elements.</h1>', '200')
コード例 #3
0
 def test_default_database_config(self):
     Application.bind('database', database)
     assert Application.get('database')['default'] == database['default']
コード例 #4
0
 def boot(self):
     Application.bind('env', self.env)
     Application.bind('config', config)
     Application.bind('response', Response(self.response))
コード例 #5
0
 def method():
     return Application.get('env')['REQUEST_METHOD']
コード例 #6
0
 def uri():
     return Application.get('env')['PATH_INFO'].strip('/')
コード例 #7
0
 def test_key_value_can_bind_to_container(self):
     Application.bind('config', "data")
     assert Application.get('config') == 'data'
コード例 #8
0
 def test_bind_function(self):
     Application.bind('config', config)
     assert Application.get('config')['basePath'] == '/path'
コード例 #9
0
 def test_expection_is_thrown_if_undefined_key_is_asked(self):
     with pytest.raises(Exception):
         Application.get('nokey')