/usr/lib/cgi-bin/mobyle/registry.py is in mobyle 1.5.5+dfsg-5.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | #!/usr/bin/python
#############################################################
# #
# Author: Herve Menager #
# Organization:'Biological Software and Databases' Group, #
# Institut Pasteur, Paris. #
# Distributed under GPLv2 Licence. Please refer to the #
# COPYING.LIB document. #
# #
#############################################################
import mb_cgi
from Mobyle.Registry import registry, DefNode, CategoryDef, ProgramDef, Registry
from Mobyle.ClassificationIndex import ClassificationIndex
from Mobyle.SearchIndex import SearchIndex
from Mobyle.DescriptionsIndex import DescriptionsIndex
import simplejson as json
def encode_registry(obj):
if isinstance(obj, Registry):
return {'categories': [encode_registry(c) for c in obj.getChildCategories()],
'programs': [encode_registry(c) for c in obj.getChildServices()]
}
elif isinstance(obj, CategoryDef):
return {'name':obj.name,
'categories': [encode_registry(c) for c in obj.getChildCategories()],
'programs': [encode_registry(c) for c in obj.getChildServices()]
}
elif isinstance(obj, ProgramDef):
return {'name': obj.name,
'description': obj.description
}
else:
return str(obj)
def process(self):
searchString = self.request.getfirst('searchString',None)
if searchString:
si = SearchIndex("program")
self.response['filterOn'] = 'true'
si.filterRegistry(searchString.split(' '))
classification = ClassificationIndex("program")
DescriptionsIndex("program").fillRegistry()
classification.buildRegistryCategories()
self.jsonMap = registry
self.encoder = encode_registry
if __name__ == "__main__":
mb_cgi.JSONCGI(processFunction=process)
|