Browse code

Minor fixes: - store names of parsed files in AwsConfig - Print total size with upload/download

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3py/trunk@40 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2007/01/11 12:37:29
Showing 1 changed files
... ...
@@ -22,6 +22,7 @@ from BidirMap import BidirMap
22 22
 from ConfigParser import ConfigParser
23 23
 
24 24
 class AwsConfig:
25
+	parsed_files = []
25 26
 	access_key = ""
26 27
 	secret_key = ""
27 28
 	host = "s3.amazonaws.com"
... ...
@@ -45,6 +46,7 @@ class AwsConfig:
45 45
 			AwsConfig.verbosity = logging._levelNames[verbosity]
46 46
 		except KeyError:
47 47
 			error("AwsConfig: verbosity level '%s' is not valid" % verbosity)
48
+		AwsConfig.parsed_files.append(configfile)
48 49
 
49 50
 class S3Error (Exception):
50 51
 	def __init__(self, response):
... ...
@@ -200,9 +202,10 @@ class S3:
200 200
 			debug("SendFile: Sending %d bytes to the server" % len(data))
201 201
 			conn.send(data)
202 202
 			size_left -= len(data)
203
-			info("Sent %d bytes (%d %%)" % (
203
+			info("Sent %d bytes (%d %% of %d)" % (
204 204
 				(size_total - size_left),
205
-				(size_total - size_left) * 100 / size_total))
205
+				(size_total - size_left) * 100 / size_total,
206
+				size_total))
206 207
 		response = {}
207 208
 		http_response = conn.getresponse()
208 209
 		response["status"] = http_response.status
... ...
@@ -236,9 +239,10 @@ class S3:
236 236
 			debug("ReceiveFile: Writing %d bytes to file '%s'" % (len(data), file.name))
237 237
 			file.write(data)
238 238
 			size_left -= len(data)
239
-			info("Received %d bytes (%d %%)" % (
239
+			info("Received %d bytes (%d %% of %d)" % (
240 240
 				(size_total - size_left),
241
-				(size_total - size_left) * 100 / size_total))
241
+				(size_total - size_left) * 100 / size_total,
242
+				size_total))
242 243
 		conn.close()
243 244
 		if response["status"] < 200 or response["status"] > 299:
244 245
 			raise S3Error(response)