rename to html_cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
include *.txt *.ini *.cfg *.rst
|
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-include tests *
|
||||||
recursive-exclude * __pycache__
|
recursive-exclude * __pycache__
|
||||||
recursive-exclude * *.py[co]
|
recursive-exclude * *.py[co]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cleanup_html
|
html_cleanup
|
||||||
============
|
============
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
@@ -7,7 +7,7 @@ Getting Started
|
|||||||
- Change directory into your newly created project if not already there. Your
|
- 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.
|
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.
|
- Create a Python virtual environment, if not already created.
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
[app:main]
|
[app:main]
|
||||||
use = egg:cleanup_html
|
use = egg:html_cleanup
|
||||||
|
|
||||||
pyramid.reload_templates = true
|
pyramid.reload_templates = true
|
||||||
pyramid.debug_authorization = false
|
pyramid.debug_authorization = false
|
||||||
@@ -32,7 +32,7 @@ listen = localhost:6543
|
|||||||
###
|
###
|
||||||
|
|
||||||
[loggers]
|
[loggers]
|
||||||
keys = root, cleanup_html
|
keys = root, html_cleanup
|
||||||
|
|
||||||
[handlers]
|
[handlers]
|
||||||
keys = console
|
keys = console
|
||||||
@@ -44,10 +44,10 @@ keys = generic
|
|||||||
level = INFO
|
level = INFO
|
||||||
handlers = console
|
handlers = console
|
||||||
|
|
||||||
[logger_cleanup_html]
|
[logger_html_cleanup]
|
||||||
level = DEBUG
|
level = DEBUG
|
||||||
handlers =
|
handlers =
|
||||||
qualname = cleanup_html
|
qualname = html_cleanup
|
||||||
|
|
||||||
[handler_console]
|
[handler_console]
|
||||||
class = StreamHandler
|
class = StreamHandler
|
||||||
|
|||||||
11
html_cleanup/__init__.py
Normal file
11
html_cleanup/__init__.py
Normal file
@@ -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()
|
||||||
3
html_cleanup/routes.py
Normal file
3
html_cleanup/routes.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
def includeme(config):
|
||||||
|
config.add_static_view('static', 'static', cache_max_age=3600)
|
||||||
|
config.add_route('home', '/')
|
||||||
BIN
html_cleanup/static/pyramid-16x16.png
Normal file
BIN
html_cleanup/static/pyramid-16x16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
html_cleanup/static/pyramid.png
Normal file
BIN
html_cleanup/static/pyramid.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
32
html_cleanup/static/theme.css
Normal file
32
html_cleanup/static/theme.css
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
8
html_cleanup/templates/404.jinja2
Normal file
8
html_cleanup/templates/404.jinja2
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{% extends "layout.jinja2" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="content">
|
||||||
|
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter project</span></h1>
|
||||||
|
<p class="lead"><span class="font-semi-bold">404</span> Page Not Found</p>
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
||||||
49
html_cleanup/templates/layout.jinja2
Normal file
49
html_cleanup/templates/layout.jinja2
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="{{request.locale_name}}">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="description" content="pyramid web application">
|
||||||
|
<meta name="author" content="Pylons Project">
|
||||||
|
<link rel="shortcut icon" href="{{request.static_url('html_cleanup:static/pyramid-16x16.png')}}">
|
||||||
|
|
||||||
|
<title>Cookiecutter Starter project for the Pyramid Web Framework</title>
|
||||||
|
|
||||||
|
<!-- Bootstrap core CSS -->
|
||||||
|
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
|
||||||
|
<!-- Custom styles for this scaffold -->
|
||||||
|
<link href="{{request.static_url('html_cleanup:static/theme.css')}}" rel="stylesheet">
|
||||||
|
|
||||||
|
<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
|
||||||
|
<script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
{% block content %}
|
||||||
|
<p>No content</p>
|
||||||
|
{% endblock content %}
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="copyright">
|
||||||
|
Copyright © Pylons Project
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Bootstrap core JavaScript
|
||||||
|
================================================== -->
|
||||||
|
<!-- Placed at the end of the document so the pages load faster -->
|
||||||
|
<script src="//code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
|
||||||
|
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
8
html_cleanup/templates/mytemplate.jinja2
Normal file
8
html_cleanup/templates/mytemplate.jinja2
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
{% extends "layout.jinja2" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="content">
|
||||||
|
<h1><span class="font-semi-bold">Pyramid</span> <span class="smaller">Starter project</span></h1>
|
||||||
|
<p class="lead">Welcome to <span class="font-normal">{{project}}</span>, a Pyramid application generated by<br><span class="font-normal">Cookiecutter</span>.</p>
|
||||||
|
</div>
|
||||||
|
{% endblock content %}
|
||||||
0
html_cleanup/views/__init__.py
Normal file
0
html_cleanup/views/__init__.py
Normal file
6
html_cleanup/views/default.py
Normal file
6
html_cleanup/views/default.py
Normal file
@@ -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'}
|
||||||
7
html_cleanup/views/notfound.py
Normal file
7
html_cleanup/views/notfound.py
Normal file
@@ -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 {}
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
[app:main]
|
[app:main]
|
||||||
use = egg:cleanup_html
|
use = egg:html_cleanup
|
||||||
|
|
||||||
pyramid.reload_templates = false
|
pyramid.reload_templates = false
|
||||||
pyramid.debug_authorization = false
|
pyramid.debug_authorization = false
|
||||||
@@ -26,7 +26,7 @@ listen = *:6543
|
|||||||
###
|
###
|
||||||
|
|
||||||
[loggers]
|
[loggers]
|
||||||
keys = root, cleanup_html
|
keys = root, html_cleanup
|
||||||
|
|
||||||
[handlers]
|
[handlers]
|
||||||
keys = console
|
keys = console
|
||||||
@@ -38,10 +38,10 @@ keys = generic
|
|||||||
level = WARN
|
level = WARN
|
||||||
handlers = console
|
handlers = console
|
||||||
|
|
||||||
[logger_cleanup_html]
|
[logger_html_cleanup]
|
||||||
level = WARN
|
level = WARN
|
||||||
handlers =
|
handlers =
|
||||||
qualname = cleanup_html
|
qualname = html_cleanup
|
||||||
|
|
||||||
[handler_console]
|
[handler_console]
|
||||||
class = StreamHandler
|
class = StreamHandler
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
addopts = --strict-markers
|
addopts = --strict-markers
|
||||||
|
|
||||||
testpaths =
|
testpaths =
|
||||||
cleanup_html
|
html_cleanup
|
||||||
tests
|
tests
|
||||||
|
|||||||
6
setup.py
6
setup.py
@@ -23,9 +23,9 @@ tests_require = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='cleanup_html',
|
name='html_cleanup',
|
||||||
version='0.0',
|
version='0.0',
|
||||||
description='cleanup_html',
|
description='html_cleanup',
|
||||||
long_description=README + '\n\n' + CHANGES,
|
long_description=README + '\n\n' + CHANGES,
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Programming Language :: Python',
|
'Programming Language :: Python',
|
||||||
@@ -46,7 +46,7 @@ setup(
|
|||||||
install_requires=requires,
|
install_requires=requires,
|
||||||
entry_points={
|
entry_points={
|
||||||
'paste.app_factory': [
|
'paste.app_factory': [
|
||||||
'main = cleanup_html:main',
|
'main = html_cleanup:main',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
###
|
###
|
||||||
|
|
||||||
[app:main]
|
[app:main]
|
||||||
use = egg:cleanup_html
|
use = egg:html_cleanup
|
||||||
|
|
||||||
pyramid.reload_templates = false
|
pyramid.reload_templates = false
|
||||||
pyramid.debug_authorization = false
|
pyramid.debug_authorization = false
|
||||||
@@ -26,7 +26,7 @@ listen = localhost:6543
|
|||||||
###
|
###
|
||||||
|
|
||||||
[loggers]
|
[loggers]
|
||||||
keys = root, cleanup_html
|
keys = root, html_cleanup
|
||||||
|
|
||||||
[handlers]
|
[handlers]
|
||||||
keys = console
|
keys = console
|
||||||
@@ -38,10 +38,10 @@ keys = generic
|
|||||||
level = INFO
|
level = INFO
|
||||||
handlers = console
|
handlers = console
|
||||||
|
|
||||||
[logger_cleanup_html]
|
[logger_html_cleanup]
|
||||||
level = DEBUG
|
level = DEBUG
|
||||||
handlers =
|
handlers =
|
||||||
qualname = cleanup_html
|
qualname = html_cleanup
|
||||||
|
|
||||||
[handler_console]
|
[handler_console]
|
||||||
class = StreamHandler
|
class = StreamHandler
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from pyramid.testing import DummyRequest, testConfig
|
|||||||
import pytest
|
import pytest
|
||||||
import webtest
|
import webtest
|
||||||
|
|
||||||
from cleanup_html import main
|
from html_cleanup import main
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
from cleanup_html.views.default import my_view
|
from html_cleanup.views.default import my_view
|
||||||
from cleanup_html.views.notfound import notfound_view
|
from html_cleanup.views.notfound import notfound_view
|
||||||
|
|
||||||
|
|
||||||
def test_my_view(app_request):
|
def test_my_view(app_request):
|
||||||
info = my_view(app_request)
|
info = my_view(app_request)
|
||||||
assert app_request.response.status_int == 200
|
assert app_request.response.status_int == 200
|
||||||
assert info['project'] == 'cleanup_html'
|
assert info['project'] == 'html_cleanup'
|
||||||
|
|
||||||
def test_notfound_view(app_request):
|
def test_notfound_view(app_request):
|
||||||
info = notfound_view(app_request)
|
info = notfound_view(app_request)
|
||||||
|
|||||||
Reference in New Issue
Block a user