@@ -1093,20 +1093,18 @@ def generate_attribution(self, template_path='templates/default.html',
10931093
10941094 # We only need the fields names and values to render the template
10951095 validated_fields = []
1096- license_text = []
10971096 notice_text = []
1098- unique_license = []
1097+ license_dict = {}
10991098 for about_object in self :
11001099 if not limit_to or about_object .about_resource_path in limit_to :
11011100 validated_fields .append (about_object .validated_fields )
11021101 notice_text .append (about_object .notice_text ())
11031102 dje_license_name = about_object .get_dje_license_name ()
11041103 if dje_license_name :
1105- if not dje_license_name in unique_license \
1104+ if not dje_license_name in license_dict \
11061105 and not dje_license_name == None :
11071106 if about_object .license_text ():
1108- unique_license .append (about_object .get_dje_license_name ())
1109- license_text .append (about_object .license_text ())
1107+ license_dict [about_object .get_dje_license_name ()] = about_object .license_text ()
11101108 else :
11111109 msg = 'About resource: %s - license_text does not exist.' \
11121110 ' License generation is skipped.' \
@@ -1115,10 +1113,9 @@ def generate_attribution(self, template_path='templates/default.html',
11151113 'dje_license' ,\
11161114 dje_license_name , msg ))
11171115 elif about_object .get_license_text_file_name ():
1118- if not about_object .get_license_text_file_name () in unique_license :
1116+ if not about_object .get_license_text_file_name () in license_dict :
11191117 if about_object .license_text ():
1120- unique_license .append (about_object .get_license_text_file_name ())
1121- license_text .append (about_object .license_text ())
1118+ license_dict [about_object .get_license_text_file_name ()] = about_object .license_text ()
11221119 else :
11231120 msg = 'About resource: %s - license_text does not exist.' \
11241121 ' License generation is skipped.' \
@@ -1133,9 +1130,9 @@ def generate_attribution(self, template_path='templates/default.html',
11331130 msg ))
11341131
11351132 return template .render (about_objects = validated_fields ,
1136- license_texts = license_text ,
1137- notice_texts = notice_text ,
1138- unique_licenses = unique_license )
1133+ license_keys = list ( license_dict . keys ()) ,
1134+ license_texts = list ( license_dict . values ()) ,
1135+ notice_texts = notice_text )
11391136
11401137 def get_genattrib_errors (self ):
11411138 return self .genattrib_errors
0 commit comments