diff --git a/kalite/control_panel/static/js/control_panel/data_export/views.js b/kalite/control_panel/static/js/control_panel/data_export/views.js index 50419d3d6f..f7563b86ac 100644 --- a/kalite/control_panel/static/js/control_panel/data_export/views.js +++ b/kalite/control_panel/static/js/control_panel/data_export/views.js @@ -104,7 +104,7 @@ var ZoneSelectView = Backbone.View.extend({ template: require('./hbtemplates/zone-select.handlebars'), - initialize: function() { + initialize: function(options) { // Create collections this.zone_list = new Models.ZoneCollection(); @@ -117,7 +117,7 @@ var ZoneSelectView = Backbone.View.extend({ // Fetch collection by org_id this.zone_list.fetch({ data: $.param({ - "org_id": this.options.org_id, + "org_id": options.org_id, "limit": 0 }) }); diff --git a/kalite/distributed/static/js/distributed/bundle_modules/base.js b/kalite/distributed/static/js/distributed/bundle_modules/base.js index 4322c20fa8..34f0780d47 100644 --- a/kalite/distributed/static/js/distributed/bundle_modules/base.js +++ b/kalite/distributed/static/js/distributed/bundle_modules/base.js @@ -14,6 +14,9 @@ require("browsernizr/test/canvas"); require("browsernizr/test/touchevents"); var Modernizr = require("browsernizr"); +// Expose this as a global object for use in central server inline JS. +global.getCookie = require("utils/get_cookie"); + global.$ = $; global._ = _; global.sessionModel = new SessionModel(); diff --git a/kalite/packages/bundled/securesync/api_client.py b/kalite/packages/bundled/securesync/api_client.py index 75653af243..9608f19bbf 100644 --- a/kalite/packages/bundled/securesync/api_client.py +++ b/kalite/packages/bundled/securesync/api_client.py @@ -13,9 +13,17 @@ class BaseClient(object): - def __init__(self, host="%s://%s/" % (settings.SECURESYNC_PROTOCOL, settings.CENTRAL_SERVER_HOST), require_trusted=True, verbose=True): - self.parsed_url = urllib2.urlparse.urlparse(host) - self.url = "%s://%s" % (self.parsed_url.scheme, self.parsed_url.netloc) + def __init__(self, host=None, require_trusted=True, verbose=True): + + if not host: + if settings.CENTRAL_SERVER_URL: + self.url = settings.CENTRAL_SERVER_URL + else: + self.url = "%s://%s/" % (settings.SECURESYNC_PROTOCOL, settings.CENTRAL_SERVER_HOST) + else: + parsed_url = urllib2.urlparse.urlparse(host) + self.url = "%s://%s" % (self.parsed_url.scheme, self.parsed_url.netloc) + self.require_trusted = require_trusted self.verbose = verbose diff --git a/kalite/packages/bundled/securesync/devices/api_views.py b/kalite/packages/bundled/securesync/devices/api_views.py index 6afdb23abd..4894cf2b49 100755 --- a/kalite/packages/bundled/securesync/devices/api_views.py +++ b/kalite/packages/bundled/securesync/devices/api_views.py @@ -57,7 +57,7 @@ def register_device(request): # that what should be proper exception namespacing in code being called isn't correctly catching this exception msg = "\n\n".join([request.body, client_device._hashable_representation(), "Exception: %s" % e, str(type(e)), client_device.signed_by_id, client_device.id, str(request)]) send_mail("Exception while verifying client device", msg, "kalite@learningequality.org", ["errors@learningequality.org"]) - return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key!", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE) + return JsonResponseMessageError("Client device must be self-signed with a signature matching its own public key.", code=EC.CLIENT_DEVICE_INVALID_SIGNATURE) try: zone = register_self_registered_device(client_device, models, data) diff --git a/kalite/packages/bundled/securesync/management/commands/register.py b/kalite/packages/bundled/securesync/management/commands/register.py index 4b2c53e7e3..649d5313e9 100644 --- a/kalite/packages/bundled/securesync/management/commands/register.py +++ b/kalite/packages/bundled/securesync/management/commands/register.py @@ -61,7 +61,7 @@ def handle(self, *args, **options): csrftoken = s.cookies['csrftoken_central'] login_data = dict(username=options["username"], password=options["password"], csrfmiddlewaretoken=csrftoken, next='/') r = s.post(login_url, data=login_data, headers={"Referer": login_url}) - assert r.status_code == 200, "Error logging into central server: " + r.content + assert r.status_code == 200 and "Incorrect user" not in r.content, "Error logging into central server: " + r.content # register on the central server reg_url = client.get_registration_url() @@ -80,5 +80,3 @@ def handle(self, *args, **options): own_device = Device.get_own_device() assert own_device.is_registered(), "Device was not registered successfully..." sys.stdout.write("Device '%s' has been successfully registered to zone '%s'!\n" % (own_device.id, own_device.get_zone().id)) - - diff --git a/kalite/version.py b/kalite/version.py index 1d478b956d..7c22dba8c0 100644 --- a/kalite/version.py +++ b/kalite/version.py @@ -3,7 +3,7 @@ # Must also be of the form N.N.N for internal use, where N is a non-negative integer MAJOR_VERSION = "0" MINOR_VERSION = "17" -PATCH_VERSION = "5" +PATCH_VERSION = "6.dev" VERSION = "%s.%s.%s" % (MAJOR_VERSION, MINOR_VERSION, PATCH_VERSION) SHORTVERSION = "%s.%s" % (MAJOR_VERSION, MINOR_VERSION)