Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[svn] * Updated default project template files for new configuration …
…layout. Options to handle config now just in environment.py, and middleware.py handling just middleware. * Removing mako tests, as its now the default. Default test changed from Myghty to Mako. * Changing default templating to mako. --HG-- branch : trunk
- Loading branch information
bbangert
committed
Jul 3, 2007
1 parent
9e9df11
commit d7e4575
Showing
14 changed files
with
88 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 21 additions & 11 deletions
32
pylons/templates/default_project/+package+/config/environment.py_tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,39 @@ | ||
import os | ||
|
||
import pylons.config | ||
from paste.deploy.config import CONFIG | ||
|
||
from pylons import config | ||
import webhelpers | ||
|
||
from ${package}.config.routing import make_map | ||
|
||
def load_environment(conf={}): | ||
|
||
map = make_map(conf) | ||
# Setup our paths | ||
def load_environment(global_conf, app_conf): | ||
# Create our paths | ||
root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
paths = {'root_path': root_path, | ||
'controllers': os.path.join(root_path, 'controllers'), | ||
'templates': [os.path.join(root_path, path) for path in \ | ||
('components', 'templates')], | ||
'static_files': os.path.join(root_path, 'public') | ||
} | ||
|
||
# Initialize the other basic options | ||
config.init_app(global_conf, app_conf, package='${package}', | ||
template_engine='${template_engine}', paths=paths) | ||
|
||
map = make_map(config) | ||
config['pylons.map'] = map | ||
|
||
# The following template options are passed to your template engines | ||
tmpl_options = {} | ||
tmpl_options['myghty.log_errors'] = True | ||
tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format) | ||
|
||
# Add your own template options config options here, note that all config options will override | ||
# any Pylons config options | ||
|
||
# Return our loaded config object | ||
return pylons.config.Config(tmpl_options, map, paths) | ||
# The following template options are passed to your template engines | ||
tmpl_options = {} | ||
|
||
# Load-up the template options | ||
config['buffet.template_options'] = tmpl_options | ||
|
||
# Setup the Paste CONFIG object for legacy code | ||
CONFIG.push_process_config(config._current_obj()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
tests/test_webapps/filestotest/functional_sample_controller_mako.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
from projectname.tests import * | ||
|
||
class TestCheetahController(TestController): | ||
class TestMakoController(TestController): | ||
def test_mako(self): | ||
response = self.app.get(url_for(controller='/sample', action='testmako')) | ||
assert 'Hello, 5+5 is 10' in response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.