コード例 #1
0
 def get_plugin_representation_from_store(name,
                                          store_url,
                                          version=None,
                                          username=None,
                                          password=None,
                                          timeout=30):
     """
     Get a plugin app representation from the ChRIS store.
     """
     store_client = StoreClient(store_url, username, password, timeout)
     plg = store_client.get_plugin(name, version)
     parameters = []
     offset = 0
     limit = 50
     while True:
         result = store_client.get_plugin_parameters(
             plg['id'], {
                 'limit': limit,
                 'offset': offset
             })
         parameters.extend(result['data'])
         offset += limit
         if not result['hasNextPage']: break
     plg['parameters'] = parameters
     return plg
コード例 #2
0
 def get_plugin_representation_from_store(name, store_url, username=None,
                                          password=None, timeout=30):
     """
     Get a plugin app representation from the ChRIS store.
     """
     store_client = StoreClient(store_url, username, password, timeout)
     return store_client.get_plugin(name)
コード例 #3
0
 def get_plugin_representation_from_store(name, store_url, username=None,
                                          password=None, timeout=30):
     """
     Get a plugin app representation from the ChRIS store.
     """
     store_client = StoreClient(store_url, username, password, timeout)
     return store_client.get_plugin(name)
コード例 #4
0
 def get_plugin_representation_from_store(name, version=None, timeout=30):
     """
     Get a plugin app representation from the ChRIS store.
     """
     store_url = settings.CHRIS_STORE_URL
     store_client = StoreClient(store_url, None, None, timeout)
     plg = store_client.get_plugin(name, version)
     plg['parameters'] = PluginManager.get_plugin_parameters_from_store(
         plg['id'], timeout)
     return plg
コード例 #5
0
 def get_plugin_representation_from_store_by_url(url, timeout=30):
     """
     Get a plugin app representation from the ChRIS store given the url of the plugin.
     """
     store_url = settings.CHRIS_STORE_URL
     store_client = StoreClient(store_url, None, None, timeout)
     result = store_client.get_data_from_collection(store_client.get(url))
     if result['data']:
         plg = result['data'][0]
     else:
         raise NameError("Could not find plugin with url '%s'" % url)
     plg['parameters'] = PluginManager.get_plugin_parameters_from_store(
         plg['id'], timeout)
     return plg
コード例 #6
0
    def get_plugin_representation_from_store_by_url(url, timeout=30):
        """
        Get a plugin app representation from the ChRIS store given the url of the plugin.
        """
        store_url = settings.CHRIS_STORE_URL
        store_client = StoreClient(store_url, None, None, timeout)
        res = store_client.get(url)
        result = store_client.get_data_from_collection(res)

        if not result['data']:
            raise NameError(f"Could not find plugin with url '{url}'")

        plg = result['data'][0]
        parameters_url = res.items[0].links.get(rel='parameters').href
        plg['parameters'] = PluginManager.get_plugin_parameters_from_url(
            parameters_url, timeout)
        return plg
コード例 #7
0
 def get_plugin_representation_from_store(name, store_url, version=None, username=None,
                                          password=None, timeout=30):
     """
     Get a plugin app representation from the ChRIS store.
     """
     store_client = StoreClient(store_url, username, password, timeout)
     plg = store_client.get_plugin(name, version)
     parameters = []
     offset = 0
     limit = 50
     while True:
         result = store_client.get_plugin_parameters(plg['id'], {'limit': limit,
                                                                 'offset': offset})
         parameters.extend(result['data'])
         offset += limit
         if not result['hasNextPage']: break
     plg['parameters'] = parameters
     return plg
コード例 #8
0
 def get_plugin_parameters_from_url(parameters_url, timeout=30):
     """
     Get a plugin's parameters representation from a ChRIS store by URL.
     """
     store_url = settings.CHRIS_STORE_URL
     store_client = StoreClient(store_url, None, None, timeout)
     parameters = []
     offset = 0
     limit = 50
     while True:
         res = store_client.get(parameters_url, {
             'limit': limit,
             'offset': offset
         })
         result = store_client.get_data_from_collection(res)
         parameters.extend(result['data'])
         offset += limit
         if not result['hasNextPage']: break
     return parameters