Fix a bug in Output.progress_generator
authorNikos Skalkotos <skalkoto@grnet.gr>
Wed, 6 Jun 2012 09:05:56 +0000 (12:05 +0300)
committerNikos Skalkotos <skalkoto@grnet.gr>
Wed, 6 Jun 2012 09:05:56 +0000 (12:05 +0300)
The progress bar of the progress generator had a wrong max attribute.

image_creator/kamaki_wrapper.py
image_creator/output.py

index e1f3a02..b8e3e6b 100644 (file)
@@ -75,8 +75,10 @@ class Kamaki(object):
                 raise FatalError("Pithos client: %d %s" % \
                                                     (e.status, e.message))
         try:
                 raise FatalError("Pithos client: %d %s" % \
                                                     (e.status, e.message))
         try:
-            hash_cb = self.out.progress_gen(hp) if hp is not None else None
-            upload_cb = self.out.progress_gen(up) if up is not None else None
+            hash_cb = self.out.progress_generator(hp) \
+                                                    if hp is not None else None
+            upload_cb = self.out.progress_generator(up) \
+                                                    if up is not None else None
             self.pithos_client.create_object(remote_path, file_obj, size,
                                                             hash_cb, upload_cb)
             return "pithos://%s/%s/%s" % \
             self.pithos_client.create_object(remote_path, file_obj, size,
                                                             hash_cb, upload_cb)
             return "pithos://%s/%s/%s" % \
index 0f33f6d..fc3c422 100644 (file)
@@ -86,12 +86,10 @@ class Output(object):
         def success(self, result):
             sucess(result)
 
         def success(self, result):
             sucess(result)
 
-    def progress_gen(self, message):
-        
-        progress = getattr(self, 'Progress')
-
+    def progress_generator(self, message):
         def generator(n):
         def generator(n):
-            progressbar = progress(message, 'default')
+            progressbar = self.Progress(message, 'default')
+            progressbar.max = n
 
             for _ in range(n):
                 yield
 
             for _ in range(n):
                 yield