Skip to content

Commit e1649a6

Browse files
authored
Merge pull request #5405 from benjaoming/assert-device-registration
Additional fixes for device registration
2 parents 019139e + 6f9be82 commit e1649a6

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

docs/installguide/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ Bug fixes
7070
* Redirect to front page if user logs in from the signup page :url-issue:`3926`
7171
* Progress bar missing when decimals in progress percentage :url-issue:`5321`
7272
* Missing cache invalidation for JavaScript meant client-side breakage: Upgraded CherryPy HTTP server to 3.3.0 :url-issue:`5317`
73+
* Error pages now include Traceback information to include for technical support :url-issue:`5405`
7374
* Implement friendlier user-facing error messages during unexpected JS failures :url-issue:`5123`
7475
* Source distribution and `ka-lite` + `ka-lite-raspberry-pi` debian packages no longer ship with English content.db, means they have reduced ~40% in file size :url-issue:`5318`
7576
* Installation works with latest ``setuptools >= 30.0`` affecting almost any recent system using ``pip install``. :url-issue:`5352`

kalite/distributed/templates/distributed/500.html

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@
66
{% block content %}
77
<h1>{% trans "Error" %}</h1>
88

9-
<p><b>{% trans "Sorry, but there was an error while trying to load the page." %}</b></p>
9+
{{ errormsg|safe }}
1010

11-
({{ errortype }}: {{ value }})
12-
{% endblock content %}
11+
<p>{% trans "If you are reporting the error, please make sure to include the following information:" %}</p>
12+
13+
<p><textarea style="width: 500px; max-width: 80%; height: 100px; font-family: monospace;" onclick="$(this).height(400), $(this).width('100%'); this.select()">URL: {{ request.path }}
14+
querystring: {{ request.GET }}
15+
{{ errortype }}: {{ value }}
16+
17+
{{ traceback }}</textarea></p>
18+
19+
{% endblock content %}

kalite/distributed/views.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
and more!
77
"""
88
import sys
9+
import traceback
10+
911
from annoying.decorators import render_to
1012
from annoying.functions import get_object_or_None
1113

@@ -277,8 +279,8 @@ def crypto_login(request):
277279

278280

279281
def handler_403(request, *args, **kwargs):
280-
context = RequestContext(request)
281-
#message = None # Need to retrieve, but can't figure it out yet.
282+
# context = RequestContext(request)
283+
# message = None # Need to retrieve, but can't figure it out yet.
282284

283285
if request.is_ajax():
284286
return JsonResponseMessageError(_("You must be logged in with an account authorized to view this page (API)."), status=403)
@@ -294,7 +296,10 @@ def handler_404(request):
294296
def handler_500(request):
295297
errortype, value, tb = sys.exc_info()
296298
context = {
299+
"request": request,
300+
"errormsg": settings.AJAX_ERROR,
297301
"errortype": errortype.__name__,
298302
"value": unicode(value),
303+
"traceback": traceback.format_exc(),
299304
}
300305
return HttpResponseServerError(render_to_string("distributed/500.html", context, context_instance=RequestContext(request)))

kalite/packages/bundled/securesync/devices/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def initialize_registration():
4343
@render_to("securesync/register_public_key_client.html")
4444
def register_public_key_client(request):
4545

46+
raise Exception("Ben is testing")
47+
4648
# Delete the registration state from the session to ensure it is refreshed next pageload
4749
del request.session["registered"]
4850

kalite/updates/tests/regression_tests.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from django.conf import settings
1+
import requests
2+
23
from django.test.utils import override_settings
34

45
from fle_utils.internet.functions import am_i_online
@@ -20,6 +21,11 @@ def setUp(self):
2021
admin_data = {"username": "admin", "password": "admin"}
2122
self.create_admin(**admin_data)
2223
self.client.login(**admin_data)
24+
25+
def test_online(self):
26+
response = requests.get("http://google.com",)
27+
google_is_online = response.status_code in (200, 301)
28+
self.assertEqual(am_i_online(), google_is_online)
2329

2430
@override_settings(CENTRAL_SERVER_URL="http://127.0.0.1:8997") # We hope this is unreachable
2531
def test_not_redirected_when_offline(self):

0 commit comments

Comments
 (0)