Skip to content

Commit 4c595b4

Browse files
agjohnsonericholscher
authored andcommitted
Add prefix URI for notifications in context data (#2440)
* Add prefix URI for notifications in context data This adds context data for constructing full URIs. * Lint fix
1 parent 90249e3 commit 4c595b4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

readthedocs/notifications/notification.py

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def get_context_data(self):
3030
return {
3131
self.context_object_name: self.object,
3232
'request': self.request,
33+
'production_uri': '{scheme}://{host}'.format(
34+
scheme='https', host=settings.PRODUCTION_DOMAIN
35+
)
3336
}
3437

3538
def get_template_names(self, backend_name, source_format=HTML):

readthedocs/rtd_tests/tests/test_notifications.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class TestNotification(Notification):
3737
self.assertEqual(notify.get_subject(),
3838
'This is {0}'.format(build.id))
3939
self.assertEqual(notify.get_context_data(),
40-
{'foo': build, 'request': req})
40+
{'foo': build,
41+
'production_uri': 'https://readthedocs.org',
42+
'request': req})
4143

4244
notify.render('site')
4345
render_to_string.assert_has_calls([

0 commit comments

Comments
 (0)