Exemple #1
0
 def is_plugin_enabled(self, name):
     return name in delegate.get_plugins(
     ) or "openlibrary.plugins." + name in delegate.get_plugins()
Exemple #2
0
        t2 = time.time()
        d['time_taken'] = t2-t1
        return d

class search_json(delegate.page):
    path = "/search"
    encoding = "json"

    @jsonapi
    def GET(self):
        i = web.input(q='', query=None, _unicode=False)
        # query can be either specified as json with parameter query or just query parameters
        query = i.pop('query')
        if query:
            query = simplejson.loads(i.query)
        else:
            query = i

        result = SearchProcessor().search(i)
        return simplejson.dumps(result)

# add search API if api plugin is enabled.
if 'api' in delegate.get_plugins():
    from infogami.plugins.api import code as api
    api.add_hook('search', search_api)

if __name__ == '__main__':
    import doctest
    doctest.testmod()
Exemple #3
0
 def is_plugin_enabled(name):
     plugin_names = delegate.get_plugins()
     return name in plugin_names or "openlibrary.plugins." + name in plugin_names
Exemple #4
0
        t2 = time.time()
        d['time_taken'] = t2-t1
        return d

class search_json(delegate.page):
    path = "/search"
    encoding = "json"

    @jsonapi
    def GET(self):
        i = web.input(q='', query=None, _unicode=False)
        # query can be either specified as json with parameter query or just query parameters
        query = i.pop('query')
        if query:
            query = simplejson.loads(i.query)
        else:
            query = i

        result = SearchProcessor().search(i)
        return simplejson.dumps(result)

# add search API if api plugin is enabled.
if 'api' in delegate.get_plugins():
    from infogami.plugins.api import code as api
    api.add_hook('search', search_api)

if __name__ == '__main__':
    import doctest
    doctest.testmod()
Exemple #5
0
 def is_plugin_enabled(self, name):
     return name in delegate.get_plugins() or "openlibrary.plugins." + name in delegate.get_plugins()
 def is_plugin_enabled(name):
     plugin_names = delegate.get_plugins()
     return name in plugin_names or "openlibrary.plugins." + name in plugin_names