[enh] Adapt yunohost-api binary to the moulinette

This commit is contained in:
Jérôme Lebleu 2014-05-19 17:22:45 +02:00
parent b21d7368ab
commit 8cf1a91593

View file

@ -35,16 +35,16 @@ if __name__ == '__main__':
init(_from_source=from_source) init(_from_source=from_source)
# Additional arguments # Additional arguments
use_cache = True cache = True
if '--no-cache' in sys.argv: if '--no-cache' in sys.argv:
use_cache = False cache = False
sys.argv.remove('--no-cache') sys.argv.remove('--no-cache')
# TODO: Add log argument # TODO: Add log argument
try: try:
# Run the server # Run the server
api(['yunohost'], 6787, api(['yunohost'], port=6787,
{('GET', '/installed'): is_installed}, use_cache) routes={('GET', '/installed'): is_installed}, use_cache=cache)
except MoulinetteError as e: except MoulinetteError as e:
from moulinette.interfaces.cli import colorize from moulinette.interfaces.cli import colorize
print('%s %s' % (colorize(m18n.g('error'), 'red'), e.strerror)) print('%s %s' % (colorize(m18n.g('error'), 'red'), e.strerror))