def origin_db_get(self, env, req):
        """
        Handles GETs to the Origin database
        The only part of the path this pays attention to is the account.
        """
        try:
            vsn, account, junk = split_path(req.path, 2, 3,
                                            rest_with_last=True)
        except ValueError:
            return HTTPBadRequest('Invalid request. '
                                  'URL format: /<api version>/<account>')
        if not account:
            return HTTPBadRequest('Invalid request. '
                                  'URL format: /<api version>/<account>')

        list_format = req.params.get('format', '')
        if list_format:
            list_format = list_format.lower()
        else:
            list_format = req.accept.best_match(ACCEPTABLE_FORMATS)
            if list_format:
                list_format = list_format.split('/')[1]

        enabled_only = None
        if req.params.get('enabled'):
            enabled_only = req.params['enabled'].lower() in TRUE_VALUES
        limit = req.params.get('limit')
        if limit:
            try:
                limit = int(limit)
            except ValueError:
                return HTTPBadRequest('Invalid limit, must be an integer')

        def get_listings(marker):
            listing_path = quote('/v1/%s/%s' % (self.origin_account, account))
            listing_path += '?format=json&marker=' + quote(marker)
            # no limit in request because may have to filter on cdn_enabled
            resp = make_pre_authed_request(
                env, 'GET', listing_path,
                agent='SwiftOrigin', swift_source='SOS').get_response(self.app)
            resp_headers = {}
            listing_formatted = []
            if resp.status_int // 100 == 2:
                cont_listing = json.loads(resp.body)
                for listing_dict in cont_listing:
                    if limit is None or len(listing_formatted) < limit:
                        try:
                            formatted_data = self._parse_container_listing(
                                account, listing_dict, list_format,
                                only_cdn_enabled=enabled_only)
                            if formatted_data:
                                listing_formatted.append(formatted_data)
                        except InvalidContentType, e:
                            self.logger.exception(e)
                            continue
                    else:
                        break
                if cont_listing and not listing_formatted:
                    # there were rows returned but none matched enabled_only-
                    # requery with new marker
                    new_marker = cont_listing[-1]['name']
                    if isinstance(new_marker, unicode):
                        new_marker = new_marker.encode('utf-8')
                    return get_listings(new_marker)
            elif resp.status_int == 404:
                raise OriginDbNotFound()
            else:
                raise OriginDbFailure('Origin db listings failure')
            return resp_headers, listing_formatted

        try:
            resp_headers, listing_formatted = get_listings(
                req.params.get('marker', ''))
            if list_format == 'xml':
                resp_headers['Content-Type'] = 'application/xml'
                response_body = (
                    '<?xml version="1.0" encoding="UTF-8"?>\n'
                    '<account name="%s">\n%s\n</account>') % (
                        account, '\n'.join(listing_formatted))

            elif list_format == 'json':
                resp_headers['Content-Type'] = 'application/json'
                response_body = json.dumps(listing_formatted)
            else:
                resp_headers['Content-Type'] = 'text/plain; charset=UTF-8'
                response_body = '\n'.join(listing_formatted) + '\n'
            return Response(body=response_body, headers=resp_headers)
        except OriginDbNotFound:
            if list_format == 'xml':
                empty_xml = '\n'.join(
                    ['<?xml version="1.0" encoding="UTF-8"?>',
                     '<account name="%s">' % account,
                     '</account>'])
                return HTTPOk(request=req,
                              headers={'Content-Type': 'application/xml'},
                              body=empty_xml)
            elif list_format == 'json':
                return HTTPOk(request=req,
                              headers={'Content-Type': 'application/json'},
                              body=json.dumps([]))

            return HTTPNoContent(request=req)
dataset/ETHPy150Open dpgoetz/sos/sos/origin.py/OriginDbHandler.origin_db_get/original