Merge pull request #154 from marksteve/next

Base scaffold cleanup
This commit is contained in:
Ryan Petrello
2012-12-09 20:19:38 -08:00
10 changed files with 63 additions and 61 deletions

View File

@@ -6,6 +6,7 @@ env:
- PYTHONPATH='.' - PYTHONPATH='.'
branches: branches:
only: only:
- master
- next - next
install: pip install -r requirements.txt --use-mirrors install: pip install -r requirements.txt --use-mirrors
script: python setup.py test --functional script: python setup.py test --functional

View File

@@ -1,15 +1,16 @@
from pecan import make_app from pecan import make_app
from ${package} import model from ${package} import model
def setup_app(config): def setup_app(config):
model.init_model() model.init_model()
return make_app( return make_app(
config.app.root, config.app.root,
static_root = config.app.static_root, static_root=config.app.static_root,
template_path = config.app.template_path, template_path=config.app.template_path,
logging = getattr(config, 'logging', {}), logging=getattr(config, 'logging', {}),
debug = getattr(config.app, 'debug', False), debug=getattr(config.app, 'debug', False),
force_canonical = getattr(config.app, 'force_canonical', True) force_canonical=getattr(config.app, 'force_canonical', True)
) )

View File

@@ -7,6 +7,6 @@
## now define the body of the template ## now define the body of the template
<header> <header>
<h1>Server Error ${status}</h1> <h1>Server Error ${status}</h1>
</header> </header>
<p>${message}</p> <p>${message}</p>

View File

@@ -7,28 +7,28 @@
## now define the body of the template ## now define the body of the template
<header> <header>
<h1><img src="/images/logo.png" /></h1> <h1><img src="/images/logo.png" /></h1>
</header> </header>
<div id="content"> <div id="content">
<p>This is a sample Pecan project.</p> <p>This is a sample Pecan project.</p>
<p> <p>
Instructions for getting started can be found online at <a Instructions for getting started can be found online at <a
href="http://pecanpy.org" target="window">pecanpy.org</a> href="http://pecanpy.org" target="window">pecanpy.org</a>
</p> </p>
<p> <p>
...or you can search the documentation here: ...or you can search the documentation here:
</p> </p>
<form method="POST" action="/"> <form method="POST" action="/">
<fieldset> <fieldset>
<input name="q" /> <input name="q" />
<input type="submit" value="Search" /> <input type="submit" value="Search" />
<fieldset> <fieldset>
<small>Enter search terms or a module, class or function name.</small> <small>Enter search terms or a module, class or function name.</small>
</form> </form>
</div> </div>

View File

@@ -1,12 +1,12 @@
<html> <html>
<head> <head>
<title>${self.title()}</title> <title>${self.title()}</title>
${self.style()} ${self.style()}
${self.javascript()} ${self.javascript()}
</head> </head>
<body> <body>
${self.body()} ${self.body()}
</body> </body>
</html> </html>
<%def name="title()"> <%def name="title()">

View File

@@ -1,19 +1,19 @@
# Server Specific Configurations # Server Specific Configurations
server = { server = {
'port' : '8080', 'port': '8080',
'host' : '0.0.0.0' 'host': '0.0.0.0'
} }
# Pecan Application Configurations # Pecan Application Configurations
app = { app = {
'root' : '${package}.controllers.root.RootController', 'root': '${package}.controllers.root.RootController',
'modules' : ['${package}'], 'modules': ['${package}'],
'static_root' : '%(confdir)s/../../public', 'static_root': '%(confdir)s/../../public',
'template_path' : '%(confdir)s/../templates', 'template_path': '%(confdir)s/../templates',
'debug' : True, 'debug': True,
'errors' : { 'errors': {
'404' : '/error/404', '404': '/error/404',
'__force_dict__' : True '__force_dict__': True
} }
} }

View File

@@ -10,7 +10,7 @@ class TestRootController(FunctionalTest):
assert response.status_int == 200 assert response.status_int == 200
def test_search(self): def test_search(self):
response = self.app.post('/', params={'q' : 'RestController'}) response = self.app.post('/', params={'q': 'RestController'})
assert response.status_int == 302 assert response.status_int == 302
assert response.headers['Location'] == 'http://pecan.readthedocs.org/en/latest/search.html?q=RestController' assert response.headers['Location'] == 'http://pecan.readthedocs.org/en/latest/search.html?q=RestController'

View File

@@ -19,7 +19,7 @@ app = {
logging = { logging = {
'loggers': { 'loggers': {
'root' : {'level': 'INFO', 'handlers': ['console']}, 'root': {'level': 'INFO', 'handlers': ['console']},
'${package}': {'level': 'DEBUG', 'handlers': ['console']} '${package}': {'level': 'DEBUG', 'handlers': ['console']}
}, },
'handlers': { 'handlers': {

View File

@@ -7,16 +7,16 @@ except ImportError:
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup( setup(
name = '${package}', name='${package}',
version = '0.1', version='0.1',
description = '', description='',
author = '', author='',
author_email = '', author_email='',
install_requires = [ install_requires=[
"pecan", "pecan",
], ],
test_suite = '${package}', test_suite='${package}',
zip_safe = False, zip_safe=False,
include_package_data = True, include_package_data=True,
packages = find_packages(exclude=['ez_setup']) packages=find_packages(exclude=['ez_setup'])
) )