diff options
Diffstat (limited to 'sugar_network/local/mounts.py')
-rw-r--r-- | sugar_network/local/mounts.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sugar_network/local/mounts.py b/sugar_network/local/mounts.py index b88a2af..cb936a7 100644 --- a/sugar_network/local/mounts.py +++ b/sugar_network/local/mounts.py @@ -22,6 +22,7 @@ from gettext import gettext as _ import active_document as ad from sugar_network.zerosugar import Bundle from sugar_network.local import activities, cache +from sugar_network.zerosugar import Spec from sugar_network.resources.volume import Request from sugar_network import local, checkin, sugar, Client from active_toolkit import util, coroutine, enforce @@ -99,6 +100,34 @@ class LocalMount(ad.VolumeCommands, _Mount): if pass_ownership and exists(path): os.unlink(path) + @ad.document_command(method='GET', cmd='feed', + mime_type='application/json') + def feed(self, guid): + result = [] + + for path in activities.checkins(guid): + try: + spec = Spec(root=path) + except Exception: + util.exception('Failed to read %r spec file', path) + continue + + result.append({ + 'guid': spec.root, + 'version': spec['version'], + 'arch': '*-*', + 'stability': 'stable', + 'commands': { + 'activity': { + 'exec': spec['Activity', 'exec'], + }, + }, + 'requires': spec.requires, + }) + + enforce(result, 'No versions') + return result + def before_create(self, request, props): props['user'] = [sugar.uid()] props['author'] = [sugar.nickname()] |