/user/willmoffat/apps/RunMap rename

author:

contributor:

published:

updated:

source uri:

Acre Doc /freebase/acre_doc

Handler:

Default Configuration:

Acre Doc /freebase/acre_doc

Handler:

Default Configuration:

Summary


if (!(acre.environ.params && acre.environ.params.appname)) {
error('Missing "appname"');
}

var...

Content


if (!(acre.environ.params && acre.environ.params.appname)) {
error('Missing "appname"');
}

var appname = acre.environ.params.appname;

var appQuery = {
"/common/topic/webpage" : [
{
"uri" : null
}
],
"name" : appname,
"type" : "/freebase/metaweb_application"
};

var data = acre.mqlread(appQuery);

if (!data) {
error('Application "'+appname+'" was not found');
}

if (!(data && data['/common/topic/webpage'] && data['/common/topic/webpage'][0] && data['/common/topic/webpage'][0].uri)) {
error('Application "'+appname+'" does not have a weblink');
}

var uri = data['/common/topic/webpage'][0].uri;

acre.start_response(301, { 'Location': uri });

acre.exit();


function error(message) {
acre.start_response(404, { 'content-type': 'text/html; charset="UTF-8"' });
acre.write('Error Error');
acre.write(''+message+'');

var query = [{
"id" : null,
"name" : null,
"type" : "/freebase/metaweb_application"
}];
var data = acre.mqlread(query);

acre.write('Valid appnames:');
for (var i=0;i' + data[i].name + '');
}

acre.write('');
acre.write('');
acre.exit();
}

Created by: willmoffat Apr 1, 2008
Last edited by: Constant Gardener Process Aug 18, 2009

Recent Discussions about None

There is no discussion about this document.

Start the Discussion »
Explore the Data
View all the data we have for /user/willmoffat/apps/RunMap
Flag this Document
Why do you want to flag this document?