Merge pull request #802 from jgable/importer003

This commit is contained in:
Hannah Wolfe 2013-09-18 04:22:07 +01:00
commit 06c3b2dc25
3 changed files with 22 additions and 5 deletions

View File

@ -363,8 +363,9 @@ adminControllers = {
}; };
return api.notifications.add(notification).then(function () { return api.notifications.add(notification).then(function () {
delete req.session.user; // temp no commit
res.redirect('/ghost/signin/'); //delete req.session.user;
res.redirect('/ghost/debug/');
}); });
}, function importFailure(error) { }, function importFailure(error) {

View File

@ -11,7 +11,9 @@ Importer000 = function () {
this.version = "000"; this.version = "000";
this.importFrom = { this.importFrom = {
"000": this.basicImport "000": this.basicImport,
"001": this.tempImport,
"002": this.tempImport
}; };
}; };
@ -29,7 +31,7 @@ Importer000.prototype.canImport = function (data) {
return when.resolve(this.importFrom[data.meta.version]); return when.resolve(this.importFrom[data.meta.version]);
} }
return when.reject("Unsupported version of data"); return when.reject("Unsupported version of data: " + data.meta.version);
}; };

View File

@ -13,5 +13,19 @@ module.exports = function (version, data) {
return when.reject("No importer found"); return when.reject("No importer found");
} }
return importer.importData(data); return importer.importData(data).otherwise(function (err) {
if (err === "Unsupported version of data: 001" || err === "Unsupported version of data: 002") {
try {
importer = require("./temp.js");
} catch (ignore) {
// Zero effs given
}
if (!importer) {
return when.reject("No importer found");
}
return importer.importData(data);
}
});
}; };