diff --git a/AUTHORS b/AUTHORS index e0cfbd333..fe390bbec 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,3 +5,6 @@ Bruno Rocha Eric Ho Filipe Amaral Lex Quarkie +Micheal Waltz +Red Hat Developers Launcher <45641108+redhat-developers-launcher@users.noreply.github.com> +marcosptf diff --git a/ChangeLog b/ChangeLog index b567b590c..8f910809b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,14 @@ CHANGES ======= +* Initial commit +* Update README.md +* Update setup.cfg +* Update README.md +* Re-factor Dockerfile to use multi-stage builds, fixes #606 +* debugger docker file (#669) +* removing flit from dockerfile (#668) +* added --pre release to readme * 0.4.1 * removed unused \_\_version\_\_ * Fix wrong template call diff --git a/Makefile b/Makefile index 57aa9b1ba..a577943df 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -.PHONY: docs test pep8 clean install build publish tree create_env devserver pandoc adduser +.PHONY: docs test pep8 clean install build publish tree createvenv devserver pandoc adduser develop test: pep8 - QUOKKA_MODE=test py.test --cov=quokka -l --tb=short --maxfail=1 tests/ + QUOKKA_MODE=test pytest --cov=quokka -l --tb=short --maxfail=1 tests/ pep8: @flake8 quokka --ignore=F403 --exclude=migrations @@ -21,17 +21,24 @@ clean: @rm -rf *.egg-info +develop: + @. .venv/bin/activate + @pip install --upgrade pip + @pip install -r requirements.txt + @pip install -r requirements-dev.txt + @pip freeze + reqs: @pip install pbr pypandoc pygments pandoc: reqs @pandoc --from=markdown --to=rst --output=README.rst README.md -install: clean pandoc - @python setup.py develop +install: + @python3.6 setup.py develop -build: clean pandoc - @python setup.py sdist bdist_wheel --universal +build: + @python3.6 setup.py sdist bdist_wheel --universal publish: build @twine upload dist/* @@ -39,9 +46,11 @@ publish: build tree: @tree -L 1 -a -I __pycache__ --dirsfirst --noreport -create_env: - @rm -rf venv - @python3.6 -m venv venv +createvenv: + @rm -rf .venv + @python3.6 -m venv .venv + @. .venv/bin/activate + @ls -lparth devserver: $(info "Running quokka project template...") diff --git a/quokka/admin/wtforms_html5.py b/quokka/admin/wtforms_html5.py index ccc3a1c09..85e01933f 100644 --- a/quokka/admin/wtforms_html5.py +++ b/quokka/admin/wtforms_html5.py @@ -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 diff --git a/quokka/core/content/models.py b/quokka/core/content/models.py index 6d2fcc4d9..3c7eb4ffb 100644 --- a/quokka/core/content/models.py +++ b/quokka/core/content/models.py @@ -227,17 +227,6 @@ def locale_modified(self): @property 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' - # } data = {} data.update(custom_var_dict(self.data.get('custom_vars'))) return data diff --git a/quokka/core/content/utils.py b/quokka/core/content/utils.py index 57aaef312..92d4f7f5c 100644 --- a/quokka/core/content/utils.py +++ b/quokka/core/content/utils.py @@ -10,9 +10,10 @@ 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', '')) 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')) diff --git a/quokka/core/content/views.py b/quokka/core/content/views.py index 74c72d288..08d6d9bc1 100644 --- a/quokka/core/content/views.py +++ b/quokka/core/content/views.py @@ -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 @@ -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, ) diff --git a/quokka/core/db.py b/quokka/core/db.py index 431c55aea..afc09ad77 100644 --- a/quokka/core/db.py +++ b/quokka/core/db.py @@ -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) diff --git a/quokka/core/views/sitemap.py b/quokka/core/views/sitemap.py index 871372817..2cdca943b 100644 --- a/quokka/core/views/sitemap.py +++ b/quokka/core/views/sitemap.py @@ -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): diff --git a/quokka/utils/upload.py b/quokka/utils/upload.py index 251e1c50f..bc8042679 100644 --- a/quokka/utils/upload.py +++ b/quokka/utils/upload.py @@ -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"