@@ -36,6 +36,7 @@ class MmdZanataError(Exception):
3636
3737
3838class NonexistentProjectError (MmdZanataError ):
39+
3940 def __init__ (self , project , version ):
4041 """
4142 Exception thrown when the user has requested a Zanata project that
@@ -47,7 +48,9 @@ def __init__(self, project, version):
4748 self .version = version
4849 self .message = "The project %s does not exist in Zanata" % project
4950
51+
5052class UnexpectedHTTPResponse (MmdZanataError ):
53+
5154 def __init__ (self , status_code , body ):
5255 """
5356 Exception thrown when an unexpected response is received from an HTTP
@@ -159,7 +162,7 @@ def get_module_catalog_from_tags(session, tags, debug=False):
159162 else :
160163 locations = []
161164 locations .append (("%s;%s;summary" % (
162- mmd .props .name ,mmd .props .stream ), 1 ))
165+ mmd .props .name , mmd .props .stream ), 1 ))
163166 catalog .add (mmd .props .summary , locations = locations )
164167
165168 # Process the description
@@ -185,7 +188,7 @@ def get_module_catalog_from_tags(session, tags, debug=False):
185188 mmd .props .name ,
186189 mmd .props .stream ,
187190 profile .props .name ),
188- 3 ))
191+ 3 ))
189192 catalog .add (profile .props .description , locations = locations )
190193
191194 return catalog
@@ -202,7 +205,7 @@ def get_translated_locales(zanata_rest_url, zanata_project,
202205 if r .status_code == 404 :
203206 print ("Project '%s:%s' does not exist." % (
204207 zanata_project , zanata_project_version ),
205- file = sys .stderr )
208+ file = sys .stderr )
206209 raise NonexistentProjectError (zanata_project , zanata_project_version )
207210 elif r .status_code != 200 :
208211 raise UnexpectedHTTPResponse (r .status_code , r .content )
@@ -294,6 +297,7 @@ def get_modulemd_translations_from_catalog_dict(catalog_dict):
294297
295298 return mmd_translations .values ()
296299
300+
297301def get_modulemd_translations (zanata_rest_url , zanata_project ,
298302 os_branch , zanata_translation_file ,
299303 debug = False ):
@@ -306,9 +310,9 @@ def get_modulemd_translations(zanata_rest_url, zanata_project,
306310 for loc in translated_locales :
307311 # Get the translation data for this locale
308312 pofile_url = zanata_rest_url + \
309- "/file/translation/%s/%s/%s/po?docId=%s" % (
310- zanata_project , os_branch , loc ,
311- zanata_translation_file )
313+ "/file/translation/%s/%s/%s/po?docId=%s" % (
314+ zanata_project , os_branch , loc ,
315+ zanata_translation_file )
312316 r = requests .get (pofile_url ,
313317 headers = {"Accept" : "application/octet-stream" })
314318 if r .status_code != 200 :
0 commit comments