for key in ('date', 'last-modified'): if key in headers: del headers[key] if 'etag' in headers: headers['etag'] = headers['etag'].strip('"') headers['x-timestamp'] = row['created_at'] headers['x-container-sync-key'] = sync_key put_object(sync_to, name=row['name'], headers=headers, contents=_Iter2FileLikeObject(body), proxy=self.proxy) self.container_puts += 1 except ClientException, err: if err.http_status == 401: self.logger.info(_('Unauth %(sync_from)r ' '=> %(sync_to)r'), {'sync_from': '%s/%s' % (quote(info['account']), quote(info['container'])), 'sync_to': sync_to}) elif err.http_status == 404: self.logger.info(_('Not found %(sync_from)r ' '=> %(sync_to)r'), {'sync_from': '%s/%s' % (quote(info['account']), quote(info['container'])), 'sync_to': sync_to}) else: self.logger.exception( _('ERROR Syncing %(db_file)s %(row)s'), {'db_file': broker.db_file, 'row': row}) self.container_failures += 1 return False except (Exception, Timeout), err: self.logger.exception(
headers['x-timestamp'] = row['created_at'] headers['x-container-sync-key'] = sync_key put_object(sync_to, name=row['name'], headers=headers, contents=_Iter2FileLikeObject(body), proxy=self.proxy) self.container_puts += 1 except ClientException, err: if err.http_status == 401: self.logger.info( _('Unauth %(sync_from)r ' '=> %(sync_to)r'), { 'sync_from': '%s/%s' % (quote(info['account']), quote(info['container'])), 'sync_to': sync_to }) elif err.http_status == 404: self.logger.info( _('Not found %(sync_from)r ' '=> %(sync_to)r'), { 'sync_from': '%s/%s' % (quote(info['account']), quote(info['container'])), 'sync_to': sync_to }) else: self.logger.exception(_('ERROR Syncing %(db_file)s %(row)s'), {
def test_quote(self): value = 'standard string' self.assertEquals('standard%20string', c.quote(value)) value = u'\u0075nicode string' self.assertEquals('unicode%20string', c.quote(value))