Commit bc549992 authored by Nikos Skalkotos's avatar Nikos Skalkotos

Merge branch 'master' into develop

Conflicts:
	kamaki/version.py
	version
parents 03a41be8 43312fd2
...@@ -23,6 +23,21 @@ Features ...@@ -23,6 +23,21 @@ Features
.. _Changelog-0.13: .. _Changelog-0.13:
v0.13.4
=======
Bug Fixes
=========
* Fix Destination headers to support unicode values (pithos object
copy and move)
v0.13.3
=======
Bug Fixes
---------
* Return object request headers in download methods
v0.13.2 v0.13.2
======= =======
......
# Copyright 2011-2014 GRNET S.A. All rights reserved. # Copyright 2011-2015 GRNET S.A. All rights reserved.
# #
# Redistribution and use in source and binary forms, with or # Redistribution and use in source and binary forms, with or
# without modification, are permitted provided that the following # without modification, are permitted provided that the following
...@@ -754,7 +754,8 @@ class PithosClient(PithosRestClient): ...@@ -754,7 +754,8 @@ class PithosClient(PithosRestClient):
if_match=None, if_match=None,
if_none_match=None, if_none_match=None,
if_modified_since=None, if_modified_since=None,
if_unmodified_since=None): if_unmodified_since=None,
headers=dict()):
"""Download an object (multiple connections, random blocks) """Download an object (multiple connections, random blocks)
:param obj: (str) remote object path :param obj: (str) remote object path
...@@ -775,14 +776,18 @@ class PithosClient(PithosRestClient): ...@@ -775,14 +776,18 @@ class PithosClient(PithosRestClient):
:param if_modified_since: (str) formated date :param if_modified_since: (str) formated date
:param if_unmodified_since: (str) formated date""" :param if_unmodified_since: (str) formated date
:param headers: (dict) placeholder to gather object headers
"""
restargs = dict( restargs = dict(
version=version, version=version,
data_range=None if range_str is None else 'bytes=%s' % range_str, data_range=None if range_str is None else 'bytes=%s' % range_str,
if_match=if_match, if_match=if_match,
if_none_match=if_none_match, if_none_match=if_none_match,
if_modified_since=if_modified_since, if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since) if_unmodified_since=if_unmodified_since,
headers=dict())
( (
blocksize, blocksize,
...@@ -790,6 +795,7 @@ class PithosClient(PithosRestClient): ...@@ -790,6 +795,7 @@ class PithosClient(PithosRestClient):
total_size, total_size,
hash_list, hash_list,
remote_hashes) = self._get_remote_blocks_info(obj, **restargs) remote_hashes) = self._get_remote_blocks_info(obj, **restargs)
headers.update(restargs.pop('headers'))
assert total_size >= 0 assert total_size >= 0
if download_cb: if download_cb:
...@@ -829,7 +835,8 @@ class PithosClient(PithosRestClient): ...@@ -829,7 +835,8 @@ class PithosClient(PithosRestClient):
if_match=None, if_match=None,
if_none_match=None, if_none_match=None,
if_modified_since=None, if_modified_since=None,
if_unmodified_since=None): if_unmodified_since=None,
headers=dict()):
"""Download an object to a string (multiple connections). This method """Download an object to a string (multiple connections). This method
uses threads for http requests, but stores all content in memory. uses threads for http requests, but stores all content in memory.
...@@ -849,6 +856,8 @@ class PithosClient(PithosRestClient): ...@@ -849,6 +856,8 @@ class PithosClient(PithosRestClient):
:param if_unmodified_since: (str) formated date :param if_unmodified_since: (str) formated date
:param headers: (dict) a placeholder dict to gather object headers
:returns: (str) the whole object contents :returns: (str) the whole object contents
""" """
restargs = dict( restargs = dict(
...@@ -857,7 +866,8 @@ class PithosClient(PithosRestClient): ...@@ -857,7 +866,8 @@ class PithosClient(PithosRestClient):
if_match=if_match, if_match=if_match,
if_none_match=if_none_match, if_none_match=if_none_match,
if_modified_since=if_modified_since, if_modified_since=if_modified_since,
if_unmodified_since=if_unmodified_since) if_unmodified_since=if_unmodified_since,
headers=dict())
( (
blocksize, blocksize,
...@@ -865,6 +875,7 @@ class PithosClient(PithosRestClient): ...@@ -865,6 +875,7 @@ class PithosClient(PithosRestClient):
total_size, total_size,
hash_list, hash_list,
remote_hashes) = self._get_remote_blocks_info(obj, **restargs) remote_hashes) = self._get_remote_blocks_info(obj, **restargs)
headers.update(restargs.pop('headers'))
assert total_size >= 0 assert total_size >= 0
if download_cb: if download_cb:
...@@ -901,7 +912,7 @@ class PithosClient(PithosRestClient): ...@@ -901,7 +912,7 @@ class PithosClient(PithosRestClient):
for thread in activethreads(): for thread in activethreads():
thread.join() thread.join()
#Command Progress Bar method # Command Progress Bar method
def _cb_next(self, step=1): def _cb_next(self, step=1):
if hasattr(self, 'progress_bar_gen'): if hasattr(self, 'progress_bar_gen'):
try: try:
...@@ -923,7 +934,8 @@ class PithosClient(PithosRestClient): ...@@ -923,7 +934,8 @@ class PithosClient(PithosRestClient):
if_match=None, if_match=None,
if_none_match=None, if_none_match=None,
if_modified_since=None, if_modified_since=None,
if_unmodified_since=None): if_unmodified_since=None,
headers=dict()):
""" """
:param obj: (str) remote object path :param obj: (str) remote object path
...@@ -950,6 +962,7 @@ class PithosClient(PithosRestClient): ...@@ -950,6 +962,7 @@ class PithosClient(PithosRestClient):
if err.status == 304 or err.status == 412: if err.status == 304 or err.status == 412:
return {} return {}
raise raise
headers.update(r.headers)
return r.json return r.json
def set_account_group(self, group, usernames): def set_account_group(self, group, usernames):
......
...@@ -738,7 +738,8 @@ class PithosRestClient(StorageClient): ...@@ -738,7 +738,8 @@ class PithosRestClient(StorageClient):
'X-Source-Version', 'X-Source-Version',
] ]
self.response_header_prefices = ['X-Object-', ] self.response_header_prefices = ['X-Object-', ]
self.request_header_prefices_to_quote = ['x-object-meta-', ] self.request_header_prefices_to_quote = [
'x-object-meta-', 'Destination']
self.set_param('format', format, iff=format) self.set_param('format', format, iff=format)
self.set_param('ignore_content_type', iff=ignore_content_type) self.set_param('ignore_content_type', iff=ignore_content_type)
...@@ -838,7 +839,8 @@ class PithosRestClient(StorageClient): ...@@ -838,7 +839,8 @@ class PithosRestClient(StorageClient):
'X-Source-Version', 'X-Source-Version',
] ]
self.response_header_prefices = ['X-Object-', ] self.response_header_prefices = ['X-Object-', ]
self.request_header_prefices_to_quote = ['x-object-meta-', ] self.request_header_prefices_to_quote = [
'x-object-meta-', 'Destination']
self.set_param('format', format, iff=format) self.set_param('format', format, iff=format)
self.set_param('ignore_content_type', iff=ignore_content_type) self.set_param('ignore_content_type', iff=ignore_content_type)
......
...@@ -1302,15 +1302,17 @@ class PithosClient(TestCase): ...@@ -1302,15 +1302,17 @@ class PithosClient(TestCase):
if_match='if and only if', if_match='if and only if',
if_none_match='if and only not', if_none_match='if and only not',
if_modified_since='what if not?', if_modified_since='what if not?',
if_unmodified_since='this happens if not!') if_unmodified_since='this happens if not!',
headers=dict())
expargs = dict(kwargs) expargs = dict(kwargs)
expargs.pop('range_str') expargs.pop('range_str')
for k in expargs: for k, v in expargs.items():
expargs[k] = None expargs[k] = None if v else v
GOH.assert_called_once_with(obj, **expargs) GOH.assert_called_once_with(obj, **expargs)
r = self.client.download_to_string(obj, **kwargs) r = self.client.download_to_string(obj, **kwargs)
expargs['data_range'] = 'bytes=%s' % kwargs['range_str'] expargs['data_range'] = 'bytes=%s' % kwargs['range_str']
expargs.pop('headers')
for k, v in expargs.items(): for k, v in expargs.items():
self.assertEqual( self.assertEqual(
GET.mock_calls[-1][2][k], GET.mock_calls[-1][2][k],
......
__version__ = "0.13.2next" __version__ = "0.13.4next"
__version_vcs_info__ = { __version_vcs_info__ = {
'branch': 'develop', 'branch': 'develop',
'revid': 'ce8d24b', 'revid': '14f2b91',
'revno': 2506} 'revno': 2537}
__version_user_email__ = "skalkoto@grnet.gr" __version_user_email__ = "skalkoto@grnet.gr"
__version_user_name__ = "Nikos Skalkotos" __version_user_name__ = "Nikos Skalkotos"
0.13.2next 0.13.4next
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment