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='.'
branches:
only:
- master
- next
install: pip install -r requirements.txt --use-mirrors
script: python setup.py test --functional

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,7 @@ class FunctionalTest(TestCase):
Used for functional tests where you need to test your
literal application and its integration with the framework.
"""
def setUp(self):
self.app = load_test_app(os.path.join(
os.path.dirname(__file__),

View File

@@ -1,25 +1,25 @@
# Server Specific Configurations
server = {
'port' : '8080',
'host' : '0.0.0.0'
'port': '8080',
'host': '0.0.0.0'
}
# Pecan Application Configurations
app = {
'root' : '${package}.controllers.root.RootController',
'modules' : ['${package}'],
'static_root' : '%(confdir)s/../../public',
'template_path' : '%(confdir)s/../templates',
'debug' : True,
'errors' : {
'404' : '/error/404',
'__force_dict__' : True
'root': '${package}.controllers.root.RootController',
'modules': ['${package}'],
'static_root': '%(confdir)s/../../public',
'template_path': '%(confdir)s/../templates',
'debug': True,
'errors': {
'404': '/error/404',
'__force_dict__': True
}
}
# Custom Configurations must be in Python dictionary format::
#
# foo = {'bar':'baz'}
#
#
# All configurations are accessible at::
# pecan.conf

View File

@@ -4,16 +4,16 @@ from ${package}.tests import FunctionalTest
class TestRootController(FunctionalTest):
def test_get(self):
response = self.app.get('/')
assert response.status_int == 200
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.headers['Location'] == 'http://pecan.readthedocs.org/en/latest/search.html?q=RestController'
def test_get_not_found(self):
response = self.app.get('/a/bogus/url', expect_errors=True)
assert response.status_int == 404

View File

@@ -8,7 +8,7 @@ server = {
app = {
'root': '${package}.controllers.root.RootController',
'modules': ['${package}'],
'static_root': '%(confdir)s/public',
'static_root': '%(confdir)s/public',
'template_path': '%(confdir)s/${package}/templates',
'debug': True,
'errors': {
@@ -19,7 +19,7 @@ app = {
logging = {
'loggers': {
'root' : {'level': 'INFO', 'handlers': ['console']},
'root': {'level': 'INFO', 'handlers': ['console']},
'${package}': {'level': 'DEBUG', 'handlers': ['console']}
},
'handlers': {

View File

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