def GET(self): manager = manager_factory.plugin_manager() type_defs = manager.types() for t in type_defs: href = link.child_link_obj(t['id']) t.update(href) return self.ok(type_defs)
def GET(self): manager = manager_factory.plugin_manager() importers = manager.importers() for i in importers: href = link.child_link_obj(i['id']) i.update(href) return self.ok(importers)
def GET(self): manager = manager_factory.plugin_manager() distributors = manager.distributors() for d in distributors: href = link.child_link_obj(d['id']) d.update(href) return self.ok(distributors)
def GET(self, distributor_type_id): manager = manager_factory.plugin_manager() all_distributors = manager.distributors() matching_distributors = [d for d in all_distributors if d['id'] == distributor_type_id] if len(matching_distributors) is 0: raise MissingResource(distributor_type_id=distributor_type_id) else: d = all_distributors[0] href = link.current_link_obj() d.update(href) return self.ok(d)
def GET(self, type_id): manager = manager_factory.plugin_manager() all_types = manager.types() matching_types = [t for t in all_types if t['id'] == type_id] if len(matching_types) is 0: raise MissingResource(type=type_id) else: t = matching_types[0] href = link.current_link_obj() t.update(href) return self.ok(t)
def GET(self, importer_type_id): manager = manager_factory.plugin_manager() all_importers = manager.importers() matching_importers = [i for i in all_importers if i['id'] == importer_type_id] if len(matching_importers) is 0: raise MissingResource(importer_type_id=importer_type_id) else: i = matching_importers[0] href = link.current_link_obj() i.update(href) return self.ok(i)
def get(self, request): """ Return a response containing a serialized list of importers present in the server. :param request: WSGI request object :type request: django.core.handlers.wsgi.WSGIRequest :return : Response containing a serialized list of dicts containing importer data :rtype : django.http.HttpResponse """ manager = factory.plugin_manager() all_importers = manager.importers() for importer in all_importers: importer['_href'] = '/'.join([request.get_full_path().rstrip('/'), importer['id'], '']) return generate_json_response(all_importers)
def migrate(*args, **kwargs): """ Perform the migration as described in this module's docblock. :param args: unused :type args: list :param kwargs: unused :type kwargs: dict """ plugin_manager = factory.plugin_manager() types = plugin_manager.types() for content_type in types: collection = database.type_units_collection(content_type['id']) collection.update({constants.PULP_USER_METADATA_FIELDNAME: {'$exists': False}}, {'$set': {constants.PULP_USER_METADATA_FIELDNAME: {}}}, multi=True)
def get(self, request): """ Return response containing a serialized list of dicts, one for each distributor. :param request: WSGI Request object :type request: django.core.handlers.wsgi.WSGIRequest :return : Response containing a serialized list of dicts, one for each distributor :rtype : django.http.HttpResponse """ manager = factory.plugin_manager() all_distributors = manager.distributors() for distributor in all_distributors: distributor['_href'] = '/'.join([request.get_full_path().rstrip('/'), distributor['id'], '']) return generate_json_response(all_distributors)
def get(self, request): """ Get all type definitions :param request: WSGI Request obect :type request: django.core.handlers.wsgi.WSGIRequest :return : Response containing serialized list data for all available content types :rtype : django.http.HttpResponse """ manager = factory.plugin_manager() type_defs = manager.types() for type_definition in type_defs: href = {'_href': '/'.join([request.get_full_path().rstrip('/'), type_definition['id'], ''])} type_definition.update(href) return generate_json_response_with_pulp_encoder(type_defs)
def get(self, request, type_id): """ Return a single type definition. :param request: WSGI request object :type request: django.core.handlers.wsgi.WSGIRequst :return : Serialized response containing a type definition :rtype : HttpResponse :raises : MissingResource if type_id is not found """ manager = factory.plugin_manager() all_types = manager.types() for plugin_type in all_types: if plugin_type['id'] == type_id: plugin_type['_href'] = request.get_full_path() return generate_json_response_with_pulp_encoder(plugin_type) raise MissingResource(type=type_id)
def get(self, request, distributor_id): """ Return a response contaning serialized data for the specified distributor. :param request : WSGI request object :type request : django.core.handlers.wsgi.WSGIRequest :param distributor_id: id of distributor to match :type distributor_id: string :return : Response containing serialized data for the specified distributor :rtype : django.http.HttpResponse :raises : MissingResource if distributor_id is not found """ manager = factory.plugin_manager() all_distributors = manager.distributors() for distributor in all_distributors: if distributor['id'] == distributor_id: distributor['_href'] = request.get_full_path() return generate_json_response(distributor) raise MissingResource(distributor_type_id=distributor_id)
def get(self, request, importer_id): """ Return a response containing serialized data for the specified importer. :param request : WSGI request object :type request : django.core.handlers.wsgi.WSGIRequest :param importer_id : name of importer to return information for :type importer_id : string :return : Response containing serialized data for specified importer :rtype : django.http.HttpResponse :raises : MissingResource if importer_id cannot be found """ manager = factory.plugin_manager() all_importers = manager.importers() for importer in all_importers: if importer['id'] == importer_id: importer['_href'] = request.get_full_path() return generate_json_response(importer) raise MissingResource(importer_type_id=importer_id)