Esempio n. 1
0
 def listManagement(self, vendor=None, product=None):
     try:
         if product is None:
             # no product selected yet, so same function as /browse can be used
             if vendor:
                 vendor = urllib.parse.quote_plus(vendor).lower()
             browseList = getBrowseList(vendor)
             vendor = browseList["vendor"]
             product = browseList["product"]
             version = None
         else:
             # product selected, product versions required
             version = getVersionsOfProduct(
                 urllib.parse.quote_plus(product).lower())
         return render_template("listmanagement.html",
                                vendor=vendor,
                                product=product,
                                version=version)
     except redisExceptions.ConnectionError:
         return render_template(
             "error.html",
             status={
                 "except": "redis-connection",
                 "info": {
                     "host": Configuration.getRedisHost(),
                     "port": Configuration.getRedisPort(),
                 },
             },
         )
Esempio n. 2
0
    def get(self, vendor):
        """
        List products of vendor

        Returns a list of products of a specific vendor.
        When the link is called, it enumerates the products for said vendor.
        """
        browseList = getBrowseList(vendor)

        return browseList
Esempio n. 3
0
    def get(self):
        """
        List vendors

        Returns a list of vendors.
        When the link is called, it will return a list of possible vendors.
        """
        browse_list = getBrowseList(None)

        return browse_list
Esempio n. 4
0
 def api_browse(self, vendor=None):
     if vendor:
         vendor = urllib.parse.quote_plus(vendor).lower()
     try:
         browseList = getBrowseList(vendor)
     except redis_connection_error:
         raise (APIError("Server could not connect to the browsing repository", 503))
     if isinstance(browseList, dict):
         return browseList
     else:
         return {}