diff --git a/duster/helpers/core/engine.js b/duster/helpers/core/engine.js index 6599652c..682d3d72 100644 --- a/duster/helpers/core/engine.js +++ b/duster/helpers/core/engine.js @@ -571,6 +571,8 @@ module.exports = function(app, dust) var skip = context.resolve(params.skip); var nodeSort = context.resolve(params.nodeSort); var nodeSortDirection = context.resolve(params.nodeSortDirection); + var nodeSkip = context.resolve(params.nodeSkip); + var nodeLimit = context.resolve(params.nodeLimit); // as var as = context.resolve(params.as); @@ -592,6 +594,14 @@ module.exports = function(app, dust) { skip = parseInt(skip); } + if (isDefined(nodeLimit)) + { + nodeLimit = parseInt(nodeLimit); + } + if (isDefined(nodeSkip)) + { + nodeSkip = parseInt(nodeSkip); + } // TRACKER: START tracker.start(context); @@ -732,7 +742,8 @@ module.exports = function(app, dust) } pagination = { - limit: otherNodeIds.length + limit: nodeLimit || limit || otherNodeIds.length, + skip: nodeSkip || skip || 0 }; if (nodeSort) { diff --git a/middleware/form/form.js b/middleware/form/form.js index 2104ff8c..88de58b6 100644 --- a/middleware/form/form.js +++ b/middleware/form/form.js @@ -143,10 +143,10 @@ exports = module.exports = function() }, function(err, response, body) { console.log("Response error: " + JSON.stringify(err)); - console.log("Response: " + response); - console.log("Body: " + JSON.stringify(body)); + console.log("Response: " + JSON.stringify(response,null,2)); + console.log("Body: " + JSON.stringify(body,null,2)); - if (err) + if (err || (response && response.body && response.body.error)) { if (failureUrl) { @@ -157,10 +157,12 @@ exports = module.exports = function() res.status(500); res.json({ "ok": false, - "err": err, + "err": err || response.body.message, "message": body }); } + + return; } if (successUrl)