Commits

Manabu TERADA committed 5990830 Draft

for 1.0b6 - modify bug fixed for getting issue limit number, max to has issues [Manabu TERADA]

Comments (0)

Files changed (1)

c2/recipe/bitbucketbk/backuprunner.py

 Created by Manabu Terada on 2012-01-08.
 Copyright (c) 2012 CMScom. All rights reserved.
 """
-#from StringIO import StringIO
+from StringIO import StringIO
 from datetime import datetime
 from functools import partial
 import os
     try:
         bitbucket_obj = urllib2.urlopen(req)
     except HTTPError:
-        raise "Could not get JSON from bitbucket"
+        raise Exception, "Could not get JSON from bitbucket"
     return bitbucket_obj
 
 def get_repositories(access_api_base, user):
         wb.save(f)
 
 def backup_isseus(access_api_base, repo_name, user, issues_folder_location):
-    api_url = BITBUCKET_API + "repositories/" + user + "/" + repo_name.lower() + "/issues?limit=50"
-    bitbucket_obj = access_api_base(api_url)
+    api_url = BITBUCKET_API + "repositories/" + user + "/" + repo_name.lower() + "/issues"
+    bitbucket_obj = access_api_base(api_url+"?limit=50")
     issues_obj = json.load(bitbucket_obj)
     count = issues_obj.get('count', 0)
     issues = issues_obj.get('issues', [])
     for c in range(count / 50):
         start = str((c + 1) * 50)
-        bitbucket_add_obj = access_api_base(api_url+"&start="+start)
+        bitbucket_add_obj = access_api_base(api_url+"?limit=50&start="+start)
         issues_add = json.load(bitbucket_add_obj).get('issues', [])
         issues.append(issues_add)
     _save_excel_data(issues_folder_location, repo_name, issues, access_api_base, api_url)