295 Commits

Author SHA1 Message Date
Victor Stinner
155053ea61 Fix swiftclient.client.quote() for Python 3
On Python 3, urllib.parse.quote() accepts bytes and str (unicode) types and
always return str (unicode).

Add also more tests with non-ASCII characters.

Change-Id: I8e0f19da7240e874392327d0da074ed4abb7d213
2014-04-07 10:30:18 +02:00
Jenkins
c5cc2b7b7e Merge "Use the standard library's copy of mock when it's available." 2014-04-05 09:46:04 +00:00
Florent Flament
1eaf4c549f Update help message to specify unit of --segment-size option.
Change-Id: Ic3f9a733329c19c4e0bb85676da28a8d1d74232b
Closes-Bug: 1302566
2014-04-04 15:10:40 +00:00
OpenStack Jenkins
fa65fbbce5 Updated from global requirements
Change-Id: I96dfa12efee068be885f8acc94175ce3b60fe827
2014-04-02 23:20:12 +00:00
Jenkins
132c643156 Merge "Removed usage of tuple unpacking in parameters." 2014-04-02 19:55:59 +00:00
Jenkins
e0fa104115 Merge "Replaced print statements with print function." 2014-04-01 23:05:22 +00:00
Jenkins
98e36e9438 Merge "don't use mutable defaults in kwargs" 2014-04-01 15:21:22 +00:00
Jenkins
cda26a32c1 Merge "set user-agent header" 2014-04-01 15:21:20 +00:00
Jenkins
296d3ed4ce Merge "Decode HTTP responses, fixes bug #1282861" 2014-04-01 14:08:34 +00:00
Alex Gaynor
4e7bc75432 Use the standard library's copy of mock when it's available.
Change-Id: Id6a31157582efe47cc3a74e6658679c2bec14767
2014-03-31 11:34:49 -07:00
Alex Gaynor
1d0c97fdb3 Replaced print statements with print function.
This is needed for Python3 compatibility.

Change-Id: Iadd21e4b3a936b601a69f1db2aba8e1597f13fc3
2014-03-30 12:56:43 -07:00
Alex Gaynor
97662952fd Removed usage of tuple unpacking in parameters.
Replaced it with traditional tuple unpacking. Needed for Python 3 support.

Change-Id: I714f32859f9b1ec7216eae777ea8968b5826af3b
2014-03-30 12:50:12 -07:00
Jenkins
21db1bf836 Merge "Python 3: Get compatible types from six" 2014-03-30 19:48:34 +00:00
John Dickinson
1f0dd002db don't use mutable defaults in kwargs
Change-Id: I3ae71259ccc49a5d8a852388784c3dfd577df50a
2014-03-30 10:29:36 -07:00
John Dickinson
4f3d6e7f3a set user-agent header
Change-Id: Ia67807667b4b5177d83cce9fcf16d98dc5024fbc
2014-03-30 10:29:07 -07:00
Victor Stinner
12f86fdcc5 Python 3: Get compatible types from six
* Replace unicode with six.text_type
* Replace basestring with six.string_types
* The long type doesn't exist in Python 3 anymore: replace 1L with long(1) and
  only test this type with Python 2
* Fix quote(): quote the URL if the string is a byte string. Use "bytes" type
  instead of "str" to be Python 3 compatible.

Change-Id: I1df5aa85e4e7d07191fb5c654d52fc4bd8b9f440
2014-03-28 15:48:50 +00:00
Victor Stinner
e3b7ecd2bb Python 3: Fix module names in import
Use six.moves to fix imports on Python 3.

Change-Id: I35b9405690e9f0607b24d79aa7c00830df954c41
2014-03-28 15:04:14 +00:00
Jenkins
cdf6f84c36 Merge "Python 3: Add six dependency" 2014-03-28 14:37:14 +00:00
Jenkins
b6ecec3cca Merge "Python 3: cast map() result to list" 2014-03-28 10:14:27 +00:00
Jenkins
14f0c89cc1 Merge "Python 3: Fix tests using temporary text files" 2014-03-28 10:14:26 +00:00
Jenkins
7dcefe1b64 Merge "Python 3: Replace iter.next() with six.next(iter)" 2014-03-28 09:59:03 +00:00
Victor Stinner
ac92c5cd7f Python 3: Add six dependency
Change-Id: I350eb089e02b4c33cf34c9fdb65289a2ad77f9c9
2014-03-28 09:25:11 +01:00
Victor Stinner
701faf0d16 Replace dict.iteritems() with dict.items()
dict.iteritems() has been removed in Python 3. In Python 2, dict.items()
creates a temporary list, but Samuel Merritt wrote:

"The size of the data is small enough that we don't need to worry about the
memory consumption; it's all just HTTP headers."

Change-Id: Iac427b8bbd032e4a1efb2bdc84a3968217eb6ddf
2014-03-27 12:21:25 +01:00
Victor Stinner
46d62bd9be Python 3: Replace iter.next() with six.next(iter)
Use six.next() to be Python 3 compatible.

Change-Id: Ia16148a759d368872787d5896a7b1dc42ffcdfb5
2014-03-27 12:13:49 +01:00
Christian Schwede
100419c0b3 Make bin/swift testable part 1
To make bin/swift importable for testing it needs to be renamed/moved.
The final idea is to move it to swiftclient/shell.py and add only a stub
in bin/swift to import swiftclient/shell.py.

However, doing this in a single step makes reviewing very hard, because
now there are > 1400 lines deleted from bin/swift and added to
swiftclient/shell.py - Gerrit doesn't detect the moved file.

For example: https://review.openstack.org/#/c/73710/2/

This patch first moves the code to swiftclient/shell.py and uses
setup.py/cfg to create the stub file in bin/swift. A follow up
(https://review.openstack.org/#/c/76489/) will then add the stub itself
in bin/swift (and remove the entry in setup.py).

The change to tox.ini is related to bug 1290562 and can be removed in
the future.

Change-Id: Id86392ccaf09e1d80a5d808fb49827d6d18c2588
2014-03-25 11:32:51 +00:00
Victor Stinner
9c85ea7a75 Python 3: Fix tests using temporary text files
Use mode "w" instead of the default mode "wb+" to get text file instead of
binary file on Python 3.

Change-Id: I2efe8d926309cfcd5ffe4ea963c11799773def73
2014-03-24 18:18:26 +01:00
Victor Stinner
6d5a4749b5 Python 3: cast map() result to list
On Python 3, map() returns a generator, not a list. Cast explicitly the result
of map() to a list to get a list on Python 2 and Python 3.

The cast is useless in Python 2, but it doesn't hurt performances: it's just a
unit test.

Change-Id: I87486b7dbc42507a6fd7886748a2e09735b6fc5b
2014-03-24 18:17:44 +01:00
Jenkins
070dd48c31 Merge "Copy Swift's .mailmap to swiftclient repo" 2014-03-21 08:16:48 +00:00
Jenkins
6be5c8cd77 Merge "Fix temporary pypy gate issue with setuptools" 2014-03-21 00:51:13 +00:00
Jenkins
8ff7d56037 Merge "Use six.StringIO instead of StringIO.StringIO" 2014-03-20 15:47:47 +00:00
Chmouel Boudjnah
7730a5d599 Fix temporary pypy gate issue with setuptools
Adding a fix proposed in bug 1290562 to avoid continuous gate failures
because of setuptools issue reported in the bug linked above.

Temporary Fixes-bug: #1290562

Change-Id: Ia8616d1939e664fc82de030b6384acb235e5c101
2014-03-19 10:27:19 +00:00
groqez
bffdadee57 Decode HTTP responses, fixes bug #1282861
By default, the HTTPConnection class expose the raw.read urllib3
function which doesn't do any decoding on the http response.
We can fix this by passing decode_content=True to raw.read().

Change-Id: I7d42d31ae516705d1bde2769e642931308116c7a
2014-03-18 19:47:02 +01:00
Samuel Merritt
19eb6d7dd7 Copy Swift's .mailmap to swiftclient repo
We had this before when swiftclient was in Swift's source tree, but it
didn't get copied over in the client extraction.

Change-Id: I218edcee265143164ea338e7ea95c19e72579925
2014-03-17 10:31:46 -07:00
Jenkins
d721dc7b61 Merge "Improve help strings" 2014-03-14 14:32:54 +00:00
Jenkins
41f5763b2b Merge "TCP port is appended two time in ClientException" 2014-03-12 02:13:18 +00:00
Andreas Jaeger
3dd9eddeb4 Improve help strings
Make help strings more consistent:
* Fix wording and grammar, remove duplicated words
* Add "." consistently everywhere.

Change-Id: I37f94600df2a58532633f6bab2ab82fc5e91a75b
2014-03-10 18:17:21 +01:00
Fabien Boucher
2e1a5b7e28 TCP port is appended two time in ClientException
urlparse netloc contains the TCP port if presents.
There is no need to provide conn.port when building
CLientException.

Change-Id: Id3e4fa8c4f4ab2ad693b0e8702ab69ed7c291830
2014-03-06 22:04:28 +01:00
Clay Gerrard
07dd668082 add "info" as an alias to "capabilities"
Change-Id: Ia07554250a6aae8f3a6be6a70f83690ec3fc108c
2014-03-06 13:01:49 -08:00
Jenkins
d2f3563cde Merge "Help string format persistent" 2014-03-06 00:57:16 +00:00
Jenkins
acfaed610c Merge "Make the help strings constant" 2014-03-06 00:54:36 +00:00
zhang-jinnan
26e644f7bb Use six.StringIO instead of StringIO.StringIO
Keep Python 3.x compatibility

Change-Id: If7a8f0630bd2582ca9488313dcc59805c2ce1835
2014-03-03 16:16:07 +08:00
OpenStack Jenkins
52893e3ce5 Merge "Updated from global requirements" 2.0.3 2014-02-27 04:53:09 +00:00
Jenkins
6cc1324e6e Merge "Add LengthWrapper in put_object to honor content_length param" 2014-02-27 04:52:59 +00:00
Jenkins
cfddbde81f Merge "swift.1 manpage fix for groff warnings" 2014-02-27 04:52:58 +00:00
Luis de Bethencourt
25a0e63619 Help string format persistent
Keep the format of these strings constant through all options and commands.

Change-Id: I67a47bdd5681b4b221baf55933a175568aa8e16d
2014-02-26 15:52:35 -05:00
Luis de Bethencourt
f2cd140ccd Make the help strings constant
Have all the option help strinsg match the usage text for that command.

Change-Id: I575a71769600f95c33cc4bbc9904b313f890e997
2014-02-26 15:52:35 -05:00
Clay Gerrard
3d35a3e989 Add LengthWrapper in put_object to honor content_length param
Closes-Bug:#1284360

Change-Id: Iec63a3fde77bb8195bfe46c764403b367999ff43
2014-02-25 01:12:51 -08:00
OpenStack Jenkins
f09abbf116 Updated from global requirements
Change-Id: I36af2ac149fe6b56ee3e0c54f13f1592c2f97343
2014-02-23 09:32:05 +00:00
Jenkins
f4e057923c Merge "Remove useless statement" 2014-02-19 23:17:10 +00:00
Fabien Boucher
b5b440d9b6 Remove useless statement
Change-Id: Ide74b417ede6a4976c33fc835d366ed472033fd0
2014-02-19 14:09:50 +01:00