sregistry/main/s3/query.py
def search_all(self, quiet=False):
    '''a "show all" search that doesn't require a query
       
       Parameters
       ==========
       quiet: if quiet is True, we only are using the function to return
              rows of results.
    '''

    results = []

    for obj in self.bucket.objects.all():
       subsrc = obj.Object()

       # Metadata bug will capitalize all fields, workaround is to lowercase
       # https://github.com/boto/boto3/issues/1709
       metadata = dict((k.lower(), v) for k, v in subsrc.metadata.items())
       size = ''

       # MM-DD-YYYY
       datestr = "%s-%s-%s" %(obj.last_modified.month,
                              obj.last_modified.day,
                              obj.last_modified.year)

       if 'sizemb' in metadata:
           size = '%sMB' % metadata['sizemb']

       results.append([obj.key, datestr, size ])
   
    if len(results) == 0:
        bot.info("No container collections found.")
        sys.exit(1)

    if not quiet:
        bot.info("Containers")
        bot.table(results)
    return results
def search_all(self, quiet=False):
    '''a "show all" search that doesn't require a query
       
       Parameters
       ==========
       quiet: if quiet is True, we only are using the function to return
              rows of results.
    '''

    results = []

    for obj in self.bucket.objects.all():
       subsrc = obj.Object()

       # Metadata bug will capitalize all fields, workaround is to lowercase
       # https://github.com/boto/boto3/issues/1709
       metadata = dict((k.lower(), v) for k, v in subsrc.metadata.items())
       size = ''

       # MM-DD-YYYY
       datestr = "%s-%s-%s" %(obj.last_modified.month,
                              obj.last_modified.day,
                              obj.last_modified.year)

       if 'sizemb' in metadata:
           size = '%sMB' % metadata['sizemb']

       results.append([obj.key, datestr, size ])
   
    if len(results) == 0:
        bot.info("No container collections found.")
        sys.exit(1)

    if not quiet:
        bot.info("Containers")
        bot.table(results)
    return results
a "show all" search that doesn't require a query
       
       Parameters
       ==========
       quiet: if quiet is True, we only are using the function to return
              rows of results.