Skip to content

Commit

Permalink
blog fixes for the localize branch (#6840)
Browse files Browse the repository at this point in the history
* blog fixes for the localize branch

* import

* oh flake8, you joker
  • Loading branch information
Pomax committed Jun 8, 2021
1 parent e672bc9 commit 897abcc
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
12 changes: 6 additions & 6 deletions network-api/networkapi/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
USE_S3=(bool, True),
USE_X_FORWARDED_HOST=(bool, False),
WAGTAILIMAGES_INDEX_PAGE_SIZE=(int, 60),
WAGTAILLOCALIZE_GIT_URL=(str,''),
WAGTAILLOCALIZE_GIT_CLONE_DIR=(str,''),
WAGTAIL_LOCALIZE_PRIVATE_KEY=(str,''),
WAGTAILLOCALIZE_GIT_URL=(str, ''),
WAGTAILLOCALIZE_GIT_CLONE_DIR=(str, ''),
WAGTAIL_LOCALIZE_PRIVATE_KEY=(str, ''),
WEB_MONETIZATION_POINTER=(str, ''),
XROBOTSTAG_ENABLED=(bool, False),
XSS_PROTECTION=bool,
Expand Down Expand Up @@ -442,9 +442,9 @@
('pl', gettext_lazy('Polish')),
)

WAGTAILLOCALIZE_GIT_URL=env('WAGTAILLOCALIZE_GIT_URL')
WAGTAILLOCALIZE_GIT_CLONE_DIR=env('WAGTAILLOCALIZE_GIT_CLONE_DIR')
WAGTAIL_LOCALIZE_PRIVATE_KEY=env('WAGTAIL_LOCALIZE_PRIVATE_KEY')
WAGTAILLOCALIZE_GIT_URL = env('WAGTAILLOCALIZE_GIT_URL')
WAGTAILLOCALIZE_GIT_CLONE_DIR = env('WAGTAILLOCALIZE_GIT_CLONE_DIR')
WAGTAIL_LOCALIZE_PRIVATE_KEY = env('WAGTAIL_LOCALIZE_PRIVATE_KEY')

TIME_ZONE = 'UTC'
USE_I18N = True
Expand Down
2 changes: 1 addition & 1 deletion network-api/networkapi/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,5 @@

# Use a custom 500 handler if and only if Django refuses to give any stack
# traces for server error 500... And even then, do not use this on prod.
if settings.FORCE_500_STACK_TRACES == True:
if settings.FORCE_500_STACK_TRACES is True:
handler500 = 'networkapi.utility.custom_url_handlers.server_error_500_handler'
4 changes: 3 additions & 1 deletion network-api/networkapi/utility/custom_url_handlers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys, traceback
import sys
import traceback
from django.http import HttpResponse


def server_error_500_handler(request):
type, value, tb = sys.exc_info()

Expand Down
9 changes: 3 additions & 6 deletions network-api/networkapi/wagtailpages/pagemodels/blog/blog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
StreamFieldPanel,
)
from wagtail.core import blocks
from wagtail.core.models import Orderable, Page
from wagtail.core.models import Orderable, Locale, Page
from wagtail.core.fields import StreamField
from wagtail.snippets.edit_handlers import SnippetChooserPanel

Expand Down Expand Up @@ -125,11 +125,8 @@ def get_context(self, request):
context['show_comments'] = settings.USE_COMMENTO and self.feature_comments

# Pull this object specifically using the English page title
blog_page = BlogIndexPage.objects.get(title__iexact='Blog')

# If that doesn't yield the blog page, pull using the universal title
if blog_page is None:
blog_page = BlogIndexPage.objects.get(title__iexact='Blog')
default_locale = Locale.objects.get(language_code=settings.LANGUAGE_CODE)
blog_page = BlogIndexPage.objects.get(title__iexact='Blog', locale=default_locale)

if blog_page:
context['blog_index'] = blog_page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BlogIndexPage(IndexPage):
'featured_pages',
label='Featured',
help_text='Choose two blog pages to feature',
min_num=2,
min_num=0,
max_num=2,
)
]
Expand Down

0 comments on commit 897abcc

Please sign in to comment.