Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

updating Dockerfile to 3.8 tag version #677

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Requires Docker v17.05

# Base image for build and runtime
FROM python:3.7-slim-stretch AS base
FROM python:3.8.0a4-stretch AS base
LABEL maintainer="Eric Ho <[email protected]>"

WORKDIR /usr/src/app
Expand Down Expand Up @@ -40,7 +40,7 @@ FROM base AS run

# Copy from build image
COPY --from=build /usr/src/app/ /usr/src/app/
COPY --from=build /usr/local/lib/python3.7/ /usr/local/lib/python3.7/
COPY --from=build /usr/local/lib/python3.8/ /usr/local/lib/python3.8/
COPY --from=build /usr/local/bin/quokka /usr/local/bin/quokka

WORKDIR /usr/src/app/quokka/project_template
Expand Down
2 changes: 1 addition & 1 deletion quokka/admin/wtforms_html5.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def set_title(field, render_kw=None):
"""
if render_kw is None:
render_kw = {}
if 'title' not in render_kw and getattr(field, 'description'):
if 'title' not in render_kw and getattr(field, 'description', None):
render_kw['title'] = '{}'.format(field.description)
return render_kw

Expand Down
14 changes: 7 additions & 7 deletions quokka/core/content/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ def metadata(self):
# TODO: get metadata from database
# TODO: implement libratar/gravatar
# return {
# 'cover': 'foo',
# 'author_gravatar': 'http://i.pravatar.cc/300',
# 'about_author': 'About Author',
# 'translations': ['en'],
# 'og_image': 'foo',
# 'series': 'aa',
# 'asides': 'aaa'
# 'cover': 'foo',
# 'author_gravatar': 'http://i.pravatar.cc/300',
# 'about_author': 'About Author',
# 'translations': ['en'],
# 'og_image': 'foo',
# 'series': 'aa',
# 'asides': 'aaa'
# }
data = {}
data.update(custom_var_dict(self.data.get('custom_vars')))
Expand Down
6 changes: 4 additions & 2 deletions quokka/core/content/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ def url_for_content(content, include_ext=True):
else:
data = content

category_slug_data = data.get('category_slug')
category_data = slugify_category(data.get('category') or '')
category_slug = (
data.get('category_slug') or
slugify_category(data.get('category') or '')
category_slug_data or category_data
)

slug = data.get('slug') or slugify(data.get('title'))

if category_slug:
Expand Down
5 changes: 3 additions & 2 deletions quokka/core/content/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ def render_rss(self, content_type, templates, **context):

for content in contents:
content = make_model(content)
content_data = content.title.encode('utf-8')
content_data += content.url.encode('utf-8')

if content.date > rss_pubdate:
rss_pubdate = content.date
Expand All @@ -267,8 +269,7 @@ def render_rss(self, content_type, templates, **context):
author=str(content.author),
categories=[str(content.tags)],
guid=hashlib.sha1(
content.title.encode('utf-8') +
content.url.encode('utf-8')
content_data
).hexdigest(),
pubDate=content.date,
)
Expand Down
19 changes: 8 additions & 11 deletions quokka/core/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,14 @@ def page_set(self, *args, **kwargs):
return self.content_set(*args, **kwargs)

def block_set(self, *args, **kwargs):
kwargs.setdefault(
'sort',
self.app.theme_context.get(
'BLOCK_ORDER_BY', [('title', -1)]
)
)
if not args:
args = [{'content_type': 'block'}]
elif isinstance(args[0], dict):
args[0]['content_type'] = 'block'
return self.content_set(*args, **kwargs)
kwargs.setdefault('sort', self.app.theme_context.get(
'BLOCK_ORDER_BY', [('title', -1)]
))
if not args:
args = [{'content_type': 'block'}]
elif isinstance(args[0], dict):
args[0]['content_type'] = 'block'
return self.content_set(*args, **kwargs)

def select(self, colname, *args, **kwargs):
return self.get_collection(colname).find(*args, **kwargs)
Expand Down
10 changes: 5 additions & 5 deletions quokka/core/views/sitemap.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def get_contents(self):
TODO: Should include extra paths, fixed paths
config based paths, static paths
"""
content = self.get_index() + self.get_categories()
content += self.get_tags() + self.get_authors()
content += self.get_articles_and_pages()

return (
self.get_index() +
self.get_categories() +
self.get_tags() +
self.get_authors() +
self.get_articles_and_pages()
content
)

def get_index(self):
Expand Down
2 changes: 1 addition & 1 deletion quokka/utils/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def dated_path(obj, file_data):
try:
prefix = getattr(obj, 'model_name')
prefix = getattr(obj, 'model_name', None)
except BaseException:
prefix = "undefined"

Expand Down