diff --git a/MANIFEST.in b/MANIFEST.in index 38a4f90..0372c5f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,5 +1,5 @@ include *.txt *.ini *.cfg *.rst -recursive-include cleanup_html *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 +recursive-include html_cleanup *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.jinja2 recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] diff --git a/README.txt b/README.txt index 63a12fc..7bbda37 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -cleanup_html +html_cleanup ============ Getting Started @@ -7,7 +7,7 @@ Getting Started - Change directory into your newly created project if not already there. Your current directory should be the same as this README.txt file and setup.py. - cd cleanup_html + cd html_cleanup - Create a Python virtual environment, if not already created. diff --git a/development.ini b/development.ini index f948eb1..8a33c74 100644 --- a/development.ini +++ b/development.ini @@ -4,7 +4,7 @@ ### [app:main] -use = egg:cleanup_html +use = egg:html_cleanup pyramid.reload_templates = true pyramid.debug_authorization = false @@ -32,7 +32,7 @@ listen = localhost:6543 ### [loggers] -keys = root, cleanup_html +keys = root, html_cleanup [handlers] keys = console @@ -44,10 +44,10 @@ keys = generic level = INFO handlers = console -[logger_cleanup_html] +[logger_html_cleanup] level = DEBUG handlers = -qualname = cleanup_html +qualname = html_cleanup [handler_console] class = StreamHandler diff --git a/html_cleanup/__init__.py b/html_cleanup/__init__.py new file mode 100644 index 0000000..a3d5a64 --- /dev/null +++ b/html_cleanup/__init__.py @@ -0,0 +1,11 @@ +from pyramid.config import Configurator + + +def main(global_config, **settings): + """ This function returns a Pyramid WSGI application. + """ + with Configurator(settings=settings) as config: + config.include('pyramid_jinja2') + config.include('.routes') + config.scan() + return config.make_wsgi_app() diff --git a/html_cleanup/routes.py b/html_cleanup/routes.py new file mode 100644 index 0000000..25504ad --- /dev/null +++ b/html_cleanup/routes.py @@ -0,0 +1,3 @@ +def includeme(config): + config.add_static_view('static', 'static', cache_max_age=3600) + config.add_route('home', '/') diff --git a/html_cleanup/static/pyramid-16x16.png b/html_cleanup/static/pyramid-16x16.png new file mode 100644 index 0000000..9792031 Binary files /dev/null and b/html_cleanup/static/pyramid-16x16.png differ diff --git a/html_cleanup/static/pyramid.png b/html_cleanup/static/pyramid.png new file mode 100644 index 0000000..4ab837b Binary files /dev/null and b/html_cleanup/static/pyramid.png differ diff --git a/html_cleanup/static/theme.css b/html_cleanup/static/theme.css new file mode 100644 index 0000000..6d03c6e --- /dev/null +++ b/html_cleanup/static/theme.css @@ -0,0 +1,32 @@ +@import url(//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700); +body { + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; + color: #1c1b1b; + background: #ffffff; +} +h1, +h2, +h3, +h4, +h5, +h6 { + font-family: "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: 300; +} +p { + font-weight: 300; +} +button, input, optgroup, select, textarea { + color: black; +} +.font-normal { + font-weight: 400; +} +.font-semi-bold { + font-weight: 600; +} +.font-bold { + font-weight: 700; +} + diff --git a/html_cleanup/templates/404.jinja2 b/html_cleanup/templates/404.jinja2 new file mode 100644 index 0000000..aaf1241 --- /dev/null +++ b/html_cleanup/templates/404.jinja2 @@ -0,0 +1,8 @@ +{% extends "layout.jinja2" %} + +{% block content %} +
+

Pyramid Starter project

+

404 Page Not Found

+
+{% endblock content %} diff --git a/html_cleanup/templates/layout.jinja2 b/html_cleanup/templates/layout.jinja2 new file mode 100644 index 0000000..ad1a574 --- /dev/null +++ b/html_cleanup/templates/layout.jinja2 @@ -0,0 +1,49 @@ + + + + + + + + + + + Cookiecutter Starter project for the Pyramid Web Framework + + + + + + + + + + + + + +
+
+ {% block content %} +

No content

+ {% endblock content %} +
+
+ +
+
+ + + + + + + + + diff --git a/html_cleanup/templates/mytemplate.jinja2 b/html_cleanup/templates/mytemplate.jinja2 new file mode 100644 index 0000000..f2e7283 --- /dev/null +++ b/html_cleanup/templates/mytemplate.jinja2 @@ -0,0 +1,8 @@ +{% extends "layout.jinja2" %} + +{% block content %} +
+

Pyramid Starter project

+

Welcome to {{project}}, a Pyramid application generated by
Cookiecutter.

+
+{% endblock content %} diff --git a/html_cleanup/views/__init__.py b/html_cleanup/views/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/html_cleanup/views/default.py b/html_cleanup/views/default.py new file mode 100644 index 0000000..b2a1790 --- /dev/null +++ b/html_cleanup/views/default.py @@ -0,0 +1,6 @@ +from pyramid.view import view_config + + +@view_config(route_name='home', renderer='html_cleanup:templates/mytemplate.jinja2') +def my_view(request): + return {'project': 'html_cleanup'} diff --git a/html_cleanup/views/notfound.py b/html_cleanup/views/notfound.py new file mode 100644 index 0000000..f96ca7b --- /dev/null +++ b/html_cleanup/views/notfound.py @@ -0,0 +1,7 @@ +from pyramid.view import notfound_view_config + + +@notfound_view_config(renderer='html_cleanup:templates/404.jinja2') +def notfound_view(request): + request.response.status = 404 + return {} diff --git a/production.ini b/production.ini index e6adb1b..1e4e85e 100644 --- a/production.ini +++ b/production.ini @@ -4,7 +4,7 @@ ### [app:main] -use = egg:cleanup_html +use = egg:html_cleanup pyramid.reload_templates = false pyramid.debug_authorization = false @@ -26,7 +26,7 @@ listen = *:6543 ### [loggers] -keys = root, cleanup_html +keys = root, html_cleanup [handlers] keys = console @@ -38,10 +38,10 @@ keys = generic level = WARN handlers = console -[logger_cleanup_html] +[logger_html_cleanup] level = WARN handlers = -qualname = cleanup_html +qualname = html_cleanup [handler_console] class = StreamHandler diff --git a/pytest.ini b/pytest.ini index d39aa9a..f277bf8 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,5 +2,5 @@ addopts = --strict-markers testpaths = - cleanup_html + html_cleanup tests diff --git a/setup.py b/setup.py index f8118dd..c288a4e 100644 --- a/setup.py +++ b/setup.py @@ -23,9 +23,9 @@ tests_require = [ ] setup( - name='cleanup_html', + name='html_cleanup', version='0.0', - description='cleanup_html', + description='html_cleanup', long_description=README + '\n\n' + CHANGES, classifiers=[ 'Programming Language :: Python', @@ -46,7 +46,7 @@ setup( install_requires=requires, entry_points={ 'paste.app_factory': [ - 'main = cleanup_html:main', + 'main = html_cleanup:main', ], }, ) diff --git a/testing.ini b/testing.ini index 9b02cd4..fb8f462 100644 --- a/testing.ini +++ b/testing.ini @@ -4,7 +4,7 @@ ### [app:main] -use = egg:cleanup_html +use = egg:html_cleanup pyramid.reload_templates = false pyramid.debug_authorization = false @@ -26,7 +26,7 @@ listen = localhost:6543 ### [loggers] -keys = root, cleanup_html +keys = root, html_cleanup [handlers] keys = console @@ -38,10 +38,10 @@ keys = generic level = INFO handlers = console -[logger_cleanup_html] +[logger_html_cleanup] level = DEBUG handlers = -qualname = cleanup_html +qualname = html_cleanup [handler_console] class = StreamHandler diff --git a/tests/conftest.py b/tests/conftest.py index 4f9c866..687b677 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -5,7 +5,7 @@ from pyramid.testing import DummyRequest, testConfig import pytest import webtest -from cleanup_html import main +from html_cleanup import main def pytest_addoption(parser): diff --git a/tests/test_views.py b/tests/test_views.py index afe889d..adf13bb 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -1,11 +1,11 @@ -from cleanup_html.views.default import my_view -from cleanup_html.views.notfound import notfound_view +from html_cleanup.views.default import my_view +from html_cleanup.views.notfound import notfound_view def test_my_view(app_request): info = my_view(app_request) assert app_request.response.status_int == 200 - assert info['project'] == 'cleanup_html' + assert info['project'] == 'html_cleanup' def test_notfound_view(app_request): info = notfound_view(app_request)