Exemple #1
0
 def delete_category(self, req, category_id):
     target = {'category_id': category_id}
     policy.check("delete_category", req.context, target)
     category = db_api.category_get(category_id, packages=True)
     if category.packages:
         msg = _("It's impossible to delete categories assigned "
                 "to the package, uploaded to the catalog")
         raise exc.HTTPForbidden(explanation=msg)
     db_api.category_delete(category_id)
Exemple #2
0
 def delete_category(self, req, category_id):
     target = {'category_id': category_id}
     policy.check("delete_category", req.context, target)
     category = db_api.category_get(category_id, packages=True)
     if category.packages:
         msg = _("It's impossible to delete categories assigned"
                 " to the package, uploaded to the catalog")
         raise exc.HTTPForbidden(explanation=msg)
     db_api.category_delete(category_id)
Exemple #3
0
 def get_category(self, req, category_id):
     policy.check("get_category", req.context)
     category = db_api.category_get(category_id, packages=True)
     return category.to_dict()
Exemple #4
0
 def get_category(self, req, category_id):
     policy.check("get_category", req.context)
     category = db_api.category_get(category_id, packages=True)
     return category.to_dict()