Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
Nuovo sito
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gruppo Web
Nuovo sito
Commits
3d408362
Commit
3d408362
authored
May 10, 2018
by
Pietro Albini
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'random-changes' into develop
parents
28ede21f
ebd841e0
Pipeline
#89
running with stage
Changes
4
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
1 deletion
+20
-1
setup.py
setup.py
+1
-0
uitwww/static/favicon.ico
uitwww/static/favicon.ico
+0
-0
uitwww/templates/layout.html
uitwww/templates/layout.html
+2
-1
uitwww/utils.py
uitwww/utils.py
+17
-0
No files found.
setup.py
View file @
3d408362
...
...
@@ -39,6 +39,7 @@ setuptools.setup(
"pyyaml"
,
"requests"
,
"toml"
,
"django-htmlmin"
,
],
packages
=
[
...
...
uitwww/static/favicon.ico
0 → 100644
View file @
3d408362
1.12 KB
uitwww/templates/layout.html
View file @
3d408362
...
...
@@ -27,7 +27,8 @@
<link
rel=
"stylesheet"
href=
"https://static.ubuntu-it.org/fonts/ubuntu/include.min.css"
>
<link
rel=
"stylesheet"
href=
"https://static.ubuntu-it.org/themes/italy/theme.min.css"
>
<link
rel=
"stylesheet"
href=
"{{ url_for("
static
",
filename=
"website.css"
)
}}"
/>
<link
rel=
"stylesheet"
href=
"{{ url_for("
static
",
filename=
"website.css"
)
}}"
>
<link
rel=
"shortcut icon"
href=
"{{ url_for("
static
",
filename=
"favicon.ico"
)
}}"
>
{% block extra_header %}{% endblock %}
</head>
...
...
uitwww/utils.py
View file @
3d408362
...
...
@@ -18,6 +18,7 @@ import datetime
import
random
import
string
from
htmlmin.minify
import
html_minify
import
gunicorn.app.base
as
baseapp
...
...
@@ -106,6 +107,22 @@ class ReverseProxied:
def
prepare_app
(
app
):
"""Add some utilities to the app"""
@
app
.
after_request
def
after_request
(
response
):
if
"text/html"
in
response
.
content_type
:
content
=
response
.
get_data
(
as_text
=
True
)
# Minify the HTML
content
=
html_minify
(
content
)
# Generate a random string and append it as the render ID
randstr
=
""
.
join
(
random
.
choice
(
string
.
ascii_letters
)
for
_
in
range
(
10
))
content
=
"<!--render:%s-->%s"
%
(
randstr
,
content
)
response
.
set_data
(
content
)
return
response
@
app
.
template_filter
(
"format_timestamp"
)
def
format_timestamp
(
timestamp
):
return
datetime
.
datetime
.
fromtimestamp
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment