示例#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 = query.getBrowseList(vendor)
             vendor = browseList["vendor"]
             product = browseList["product"]
             version = None
         else:
             # product selected, product versions required
             version = query.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()
                                    }
                                })
示例#2
0
 def api_browse(self, vendor=None):
     if vendor:
         vendor = urllib.parse.quote_plus(vendor).lower()
     browseList = query.getBrowseList(vendor)
     if isinstance(browseList, dict):
         return browseList
     else:
         return {}
示例#3
0
 def api_browse(self, vendor=None):
   if vendor:
     vendor = urllib.parse.quote_plus(vendor).lower()
   browseList = query.getBrowseList(vendor)
   if isinstance(browseList, dict):
     return browseList
   else:
     return {}
示例#4
0
文件: api.py 项目: adulau/cve-search
 def api_browse(self, vendor=None):
   if vendor:
     vendor = urllib.parse.quote_plus(vendor).lower()
   try:
     browseList = query.getBrowseList(vendor)
   except redisExceptions.ConnectionError:
     raise(APIError("Server could not connect to the browsing repository", 503))
   if isinstance(browseList, dict):
     return browseList
   else:
     return {}
示例#5
0
 def api_browse(self, vendor=None):
   if vendor:
     vendor = urllib.parse.quote_plus(vendor).lower()
   try:
     browseList = query.getBrowseList(vendor)
   except redisExceptions.ConnectionError:
     raise(APIError("Server could not connect to the browsing repository", 503))
   if isinstance(browseList, dict):
     return browseList
   else:
     return {}
示例#6
0
 def browse(self, vendor=None):
   try:
     if vendor is not None:
       vendor = urllib.parse.quote_plus(vendor).lower()
     browseList = query.getBrowseList(vendor)
     vendor = browseList["vendor"]
     product = browseList["product"]
     return render_template('browse.html', product=product, vendor=vendor, minimal=self.minimal)
   except redisExceptions.ConnectionError:
     return render_template('error.html', minimal=self.minimal,
                             status={'except':'redis-connection',
                                     'info':{'host':Configuration.getRedisHost(),'port':Configuration.getRedisPort()}})
示例#7
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 = query.getBrowseList(vendor)
       vendor = browseList["vendor"]
       product = browseList["product"]
       version = None
     else:
       # product selected, product versions required
       version = query.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()}})
示例#8
0
 def browse(self, vendor=None):
     try:
         if vendor is not None:
             vendor = urllib.parse.quote_plus(vendor).lower()
         browseList = query.getBrowseList(vendor)
         vendor = browseList["vendor"]
         product = browseList["product"]
         return render_template('browse.html',
                                product=product,
                                vendor=vendor,
                                minimal=self.minimal)
     except redisExceptions.ConnectionError:
         return render_template('error.html',
                                minimal=self.minimal,
                                status={
                                    'except': 'redis-connection',
                                    'info': {
                                        'host':
                                        Configuration.getRedisHost(),
                                        'port':
                                        Configuration.getRedisPort()
                                    }
                                })