@@ -1045,7 +1045,7 @@ def get_styles(self, names=None, workspaces=None):
10451045 # Add global styles
10461046 url = "{}/styles.xml" .format (self .service_url )
10471047 styles = self .get_xml (url )
1048- all_styles .extend ([ Style ( self , s . find ( 'name' ). text ) for s in styles . findall ( "style" )] )
1048+ all_styles .extend (self . __build_style_list ( styles ) )
10491049 workspaces = []
10501050 elif isinstance (workspaces , string_types ):
10511051 workspaces = [s .strip () for s in workspaces .split (',' ) if s .strip ()]
@@ -1069,8 +1069,7 @@ def get_styles(self, names=None, workspaces=None):
10691069 continue
10701070 else :
10711071 raise FailedRequestError ("Failed to get styles: {}" .format (e ))
1072-
1073- all_styles .extend ([Style (self , s .find ("name" ).text , _name (ws )) for s in styles .findall ("style" )])
1072+ all_styles .extend (self .__build_style_list (styles , ws ))
10741073
10751074 if names is None :
10761075 names = []
@@ -1082,6 +1081,15 @@ def get_styles(self, names=None, workspaces=None):
10821081
10831082 return all_styles
10841083
1084+ def __build_style_list (self , styles_tree , ws = None ):
1085+ all_styles = []
1086+ for s in styles_tree .findall ("style" ):
1087+ style_format = self .get_xml (s [1 ].attrib .get ('href' )).find ('format' ).text
1088+ style_version = self .get_xml (s [1 ].attrib .get ('href' )).find ('languageVersion' ).find (
1089+ 'version' ).text .replace ('.' , '' )[:- 1 ]
1090+ all_styles .append (Style (self , s .find ("name" ).text , _name (ws ), style_format + style_version ))
1091+ return all_styles
1092+
10851093 def get_style (self , name , workspace = None ):
10861094 '''
10871095 returns a single style object.
0 commit comments