Commit c01fe22d authored by Aurelien Vermylen's avatar Aurelien Vermylen

Fix some errors with latest commit, setup tests to avoid bad commits.

parent 2223f3f5
...@@ -11381,9 +11381,9 @@ return new Parser; ...@@ -11381,9 +11381,9 @@ return new Parser;
"type": "GET", "type": "GET",
"url": storage._url, "url": storage._url,
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: storage._withCredentials
}, },
"headers": this._headers "headers": storage._headers
}); });
}) })
.push(function (event) { .push(function (event) {
...@@ -11408,9 +11408,9 @@ return new Parser; ...@@ -11408,9 +11408,9 @@ return new Parser;
view: options._view view: options._view
}), }),
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: storage._withCredentials
}, },
"headers": this._headers "headers": storage._headers
}); });
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
...@@ -11552,9 +11552,9 @@ return new Parser; ...@@ -11552,9 +11552,9 @@ return new Parser;
url: site_hal._actions.add.href, url: site_hal._actions.add.href,
data: form_data, data: form_data,
xhrFields: { xhrFields: {
withCredentials: this._withCredentials withCredentials: context._withCredentials
}, },
"headers": this._headers "headers": context._headers
}); });
}) })
.push(function (evt) { .push(function (evt) {
...@@ -11629,6 +11629,7 @@ return new Parser; ...@@ -11629,6 +11629,7 @@ return new Parser;
}; };
ERP5Storage.prototype.getAttachment = function (id, action, options) { ERP5Storage.prototype.getAttachment = function (id, action, options) {
var context = this;
if (options === undefined) { if (options === undefined) {
options = {}; options = {};
} }
...@@ -11676,7 +11677,7 @@ return new Parser; ...@@ -11676,7 +11677,7 @@ return new Parser;
"dataType": "blob", "dataType": "blob",
"url": action, "url": action,
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: context._withCredentials
} }
}; };
if (options.start !== undefined || options.end !== undefined) { if (options.start !== undefined || options.end !== undefined) {
...@@ -11698,9 +11699,9 @@ return new Parser; ...@@ -11698,9 +11699,9 @@ return new Parser;
range = "bytes=" + start + "-" + end; range = "bytes=" + start + "-" + end;
} }
request_options.headers = {Range: range}; request_options.headers = {Range: range};
for (k in this._headers) { for (k in context._headers) {
if (this._headers.hasOwnProperty(k)) { if (context._headers.hasOwnProperty(k)) {
request_options.headers[k] = this._headers[k]; request_options.headers[k] = context._headers[k];
} }
} }
} }
...@@ -11721,6 +11722,7 @@ return new Parser; ...@@ -11721,6 +11722,7 @@ return new Parser;
}; };
ERP5Storage.prototype.putAttachment = function (id, name, blob) { ERP5Storage.prototype.putAttachment = function (id, name, blob) {
var context = this;
// Assert we use a callable on a document from the ERP5 site // Assert we use a callable on a document from the ERP5 site
if (name.indexOf(this._url) !== 0) { if (name.indexOf(this._url) !== 0) {
throw new jIO.util.jIOError("Can not store outside ERP5: " + throw new jIO.util.jIOError("Can not store outside ERP5: " +
...@@ -11762,9 +11764,9 @@ return new Parser; ...@@ -11762,9 +11764,9 @@ return new Parser;
"data": data, "data": data,
"dataType": "blob", "dataType": "blob",
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: context._withCredentials
}, },
"headers": this._headers "headers": context._headers
}); });
}); });
}; };
...@@ -11813,6 +11815,7 @@ return new Parser; ...@@ -11813,6 +11815,7 @@ return new Parser;
// jIO.Query.objectToSearchText(options.query) : // jIO.Query.objectToSearchText(options.query) :
// undefined); // undefined);
// } // }
var context = this;
return getSiteDocument(this) return getSiteDocument(this)
.push(function (site_hal) { .push(function (site_hal) {
var query = options.query, var query = options.query,
...@@ -11881,9 +11884,9 @@ return new Parser; ...@@ -11881,9 +11884,9 @@ return new Parser;
local_roles: local_roles local_roles: local_roles
}), }),
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: context._withCredentials
}, },
"headers": this._headers "headers": context._headers
}); });
}) })
.push(function (response) { .push(function (response) {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -24,9 +24,9 @@ ...@@ -24,9 +24,9 @@
"type": "GET", "type": "GET",
"url": storage._url, "url": storage._url,
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: storage._withCredentials
}, },
"headers": this._headers "headers": storage._headers
}); });
}) })
.push(function (event) { .push(function (event) {
...@@ -51,9 +51,9 @@ ...@@ -51,9 +51,9 @@
view: options._view view: options._view
}), }),
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: storage._withCredentials
}, },
"headers": this._headers "headers": storage._headers
}); });
}) })
.push(undefined, function (error) { .push(undefined, function (error) {
...@@ -195,9 +195,9 @@ ...@@ -195,9 +195,9 @@
url: site_hal._actions.add.href, url: site_hal._actions.add.href,
data: form_data, data: form_data,
xhrFields: { xhrFields: {
withCredentials: this._withCredentials withCredentials: context._withCredentials
}, },
"headers": this._headers "headers": context._headers
}); });
}) })
.push(function (evt) { .push(function (evt) {
...@@ -272,6 +272,7 @@ ...@@ -272,6 +272,7 @@
}; };
ERP5Storage.prototype.getAttachment = function (id, action, options) { ERP5Storage.prototype.getAttachment = function (id, action, options) {
var context = this;
if (options === undefined) { if (options === undefined) {
options = {}; options = {};
} }
...@@ -319,7 +320,7 @@ ...@@ -319,7 +320,7 @@
"dataType": "blob", "dataType": "blob",
"url": action, "url": action,
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: context._withCredentials
} }
}; };
if (options.start !== undefined || options.end !== undefined) { if (options.start !== undefined || options.end !== undefined) {
...@@ -341,9 +342,9 @@ ...@@ -341,9 +342,9 @@
range = "bytes=" + start + "-" + end; range = "bytes=" + start + "-" + end;
} }
request_options.headers = {Range: range}; request_options.headers = {Range: range};
for (k in this._headers) { for (k in context._headers) {
if (this._headers.hasOwnProperty(k)) { if (context._headers.hasOwnProperty(k)) {
request_options.headers[k] = this._headers[k]; request_options.headers[k] = context._headers[k];
} }
} }
} }
...@@ -364,6 +365,7 @@ ...@@ -364,6 +365,7 @@
}; };
ERP5Storage.prototype.putAttachment = function (id, name, blob) { ERP5Storage.prototype.putAttachment = function (id, name, blob) {
var context = this;
// Assert we use a callable on a document from the ERP5 site // Assert we use a callable on a document from the ERP5 site
if (name.indexOf(this._url) !== 0) { if (name.indexOf(this._url) !== 0) {
throw new jIO.util.jIOError("Can not store outside ERP5: " + throw new jIO.util.jIOError("Can not store outside ERP5: " +
...@@ -405,9 +407,9 @@ ...@@ -405,9 +407,9 @@
"data": data, "data": data,
"dataType": "blob", "dataType": "blob",
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: context._withCredentials
}, },
"headers": this._headers "headers": context._headers
}); });
}); });
}; };
...@@ -456,6 +458,7 @@ ...@@ -456,6 +458,7 @@
// jIO.Query.objectToSearchText(options.query) : // jIO.Query.objectToSearchText(options.query) :
// undefined); // undefined);
// } // }
var context = this;
return getSiteDocument(this) return getSiteDocument(this)
.push(function (site_hal) { .push(function (site_hal) {
var query = options.query, var query = options.query,
...@@ -524,9 +527,9 @@ ...@@ -524,9 +527,9 @@
local_roles: local_roles local_roles: local_roles
}), }),
"xhrFields": { "xhrFields": {
withCredentials: this._withCredentials withCredentials: context._withCredentials
}, },
"headers": this._headers "headers": context._headers
}); });
}) })
.push(function (response) { .push(function (response) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment