Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
bae91014
Commit
bae91014
authored
Jan 29, 2016
by
Zia Fazal
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11334 from edx/ziafazal/WL-210
ziafazal/WL-210: added branding to 404 and 500 error pages
parents
87d9a079
06e38e1c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
6 deletions
+82
-6
common/djangoapps/pipeline_mako/templates/static_content.html
+4
-0
lms/djangoapps/static_template_view/tests/test_views.py
+71
-2
lms/templates/static_templates/404.html
+3
-1
lms/templates/static_templates/server-error.html
+3
-2
openedx/core/djangoapps/theming/test_util.py
+1
-1
No files found.
common/djangoapps/pipeline_mako/templates/static_content.html
View file @
bae91014
...
...
@@ -125,6 +125,10 @@ else:
return
is_request_in_themed_site
()
%
></
%
def>
<
%
def
name=
"get_tech_support_email_address()"
><
%
return
get_value
('
email_from_address
',
settings
.
TECH_SUPPORT_EMAIL
)
%
></
%
def>
<
%
def
name=
"show_language_selector()"
><
%
return
settings
.
FEATURES
.
get
('
SHOW_LANGUAGE_SELECTOR
',
False
)
%
></
%
def>
lms/djangoapps/static_template_view/tests/test_views.py
View file @
bae91014
import
mimetypes
"""
Tests for static templates
"""
from
django.test
import
TestCase
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
...
...
@@ -24,3 +25,71 @@ class MarketingSiteViewTests(TestCase):
Test the about view
"""
self
.
_test_view
(
'about'
,
'text/html'
)
def
test_404
(
self
):
"""
Test the 404 view.
"""
url
=
reverse
(
'static_template_view.views.render_404'
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
[
'Content-Type'
],
'text/html'
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertContains
(
resp
,
settings
.
TECH_SUPPORT_EMAIL
)
def
test_500
(
self
):
"""
Test the 500 view.
"""
url
=
reverse
(
'static_template_view.views.render_500'
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
500
)
self
.
assertEqual
(
resp
[
'Content-Type'
],
'text/html; charset=utf-8'
)
# check response with branding
resp
=
self
.
client
.
get
(
url
)
self
.
assertContains
(
resp
,
'There has been a 500 error on the <em>{platform_name}</em> servers'
.
format
(
platform_name
=
settings
.
PLATFORM_NAME
),
status_code
=
500
)
self
.
assertContains
(
resp
,
settings
.
TECH_SUPPORT_EMAIL
,
status_code
=
500
)
def
test_404_microsites
(
self
):
"""
Test the 404 view as if called in a microsite.
"""
url
=
reverse
(
'static_template_view.views.render_404'
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
200
)
self
.
assertEqual
(
resp
[
'Content-Type'
],
'text/html'
)
# check response with branding
resp
=
self
.
client
.
get
(
url
,
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
self
.
assertContains
(
resp
,
settings
.
MICROSITE_CONFIGURATION
[
'test_microsite'
][
'email_from_address'
])
def
test_500_microsites
(
self
):
"""
Test the 500 view as if called in a microsite.
"""
url
=
reverse
(
'static_template_view.views.render_500'
)
resp
=
self
.
client
.
get
(
url
)
self
.
assertEqual
(
resp
.
status_code
,
500
)
self
.
assertEqual
(
resp
[
'Content-Type'
],
'text/html; charset=utf-8'
)
# check response with branding
resp
=
self
.
client
.
get
(
url
,
HTTP_HOST
=
settings
.
MICROSITE_TEST_HOSTNAME
)
self
.
assertContains
(
resp
,
'There has been a 500 error on the <em>{platform_name}</em> servers'
.
format
(
platform_name
=
settings
.
MICROSITE_CONFIGURATION
[
'test_microsite'
][
'platform_name'
]
),
status_code
=
500
)
self
.
assertContains
(
resp
,
settings
.
MICROSITE_CONFIGURATION
[
'test_microsite'
][
'email_from_address'
],
status_code
=
500
)
lms/templates/static_templates/404.html
View file @
bae91014
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
inherit
file=
"../main.html"
/>
...
...
@@ -6,5 +7,6 @@
<section
class=
"outside-app"
>
<h1>
${_("Page not found")}
</h1>
<p>
${_('The page that you were looking for was not found. Go back to the {link_start}homepage{link_end} or let us know about any pages that may have been moved at {email}.').format(
link_start='
<a
href=
"/"
>
', link_end='
</a>
', email='
<a
href=
"mailto:{email}"
>
{email}
</a>
'.format(email=settings.TECH_SUPPORT_EMAIL))}
</p>
link_start='
<a
href=
"/"
>
', link_end='
</a>
', email='
<a
href=
"mailto:{email}"
>
{email}
</a>
'.format(email=static.get_tech_support_email_address())
)}
</p>
</section>
lms/templates/static_templates/server-error.html
View file @
bae91014
<
%
namespace
name=
'static'
file=
'../static_content.html'
/>
<
%!
from
django
.
utils
.
translation
import
ugettext
as
_
%
>
<
%
inherit
file=
"../main.html"
/>
<section
class=
"outside-app"
>
<h1>
${_(u"There has been a 500 error on the {platform_name} servers").format(
platform_name=u"
<em>
{platform_name}
</em>
".format(platform_name=s
ettings.PLATFORM_NAME
)
platform_name=u"
<em>
{platform_name}
</em>
".format(platform_name=s
tatic.get_platform_name()
)
)}
</h1>
<p>
${_(u'Please wait a few seconds and then reload the page. If the problem persists, please email us at {email}.').format(
email=u'
<a
href=
"mailto:{email}"
>
{email}
</a>
'.format(
email=s
ettings.TECH_SUPPORT_EMAIL
email=s
tatic.get_tech_support_email_address()
)
)}
</p>
...
...
openedx/core/djangoapps/theming/test_util.py
View file @
bae91014
...
...
@@ -84,7 +84,7 @@ def with_edx_domain_context(is_edx_domain):
changes
=
comprehensive_theme_changes
(
EDX_THEME_DIR
)
with
override_settings
(
COMPREHENSIVE_THEME_DIR
=
EDX_THEME_DIR
,
**
changes
[
'settings'
]):
with
edxmako
.
save_lookups
():
for
template_dir
in
changes
[
'
mako
_paths'
]:
for
template_dir
in
changes
[
'
template
_paths'
]:
edxmako
.
paths
.
add_lookup
(
'main'
,
template_dir
,
prepend
=
True
)
yield
...
...
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