Skip to content

Commit 1049108

Browse files
committed
Merge branch 'develop' into 86_genattrib_text_update
2 parents 4d441b9 + 583584b commit 1049108

File tree

2 files changed

+35
-18
lines changed

2 files changed

+35
-18
lines changed

about_code_tool/about.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,6 +1097,7 @@ def generate_attribution(self, template_path='templates/default.html',
10971097
license_key = []
10981098
license_text = []
10991099
license_dict = {}
1100+
common_license = ['GPL 2.0','OpenSSL/SSLeay License', 'Apache License 2.0', 'BSD-Modified']
11001101
for about_object in self:
11011102
about_relative_path = '/'+ about_object.location.partition(self.user_provided_path)[2]
11021103
if not limit_to or about_relative_path in limit_to:
@@ -1140,7 +1141,9 @@ def generate_attribution(self, template_path='templates/default.html',
11401141
return template.render(about_objects=validated_fields,
11411142
license_keys=license_key,
11421143
license_texts = license_text,
1143-
notice_texts=notice_text)
1144+
notice_texts=notice_text,
1145+
license_dicts=license_dict,
1146+
common_licenses=common_license)
11441147

11451148
def get_genattrib_errors(self):
11461149
return self.genattrib_errors

about_code_tool/templates/default.html

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ <h1>OPEN SOURCE SOFTWARE INFORMATION</h1>
5050
<h3 class="component-name">{{ about_object.name }}
5151
{% if about_object.version %}{{ about_object.version }}{% endif %}
5252
</h3>
53+
{% if about_object.dje_license in license_dicts.keys() %}
54+
<p>This component is licensed under {{about_object.dje_license }}.
55+
{% endif %}
5356
{% if about_object.copyright %}
5457
<pre>{{about_object.copyright}}</pre>
5558
{% endif %}
@@ -58,30 +61,41 @@ <h3 class="component-name">{{ about_object.name }}
5861
{% elif about_object.notice_file %}
5962
<pre class="component-notice">{{ notice_texts[loop.index0] }}</pre>
6063
{% endif %}
61-
{% if about_object.dje_license in license_keys %}
62-
<p>
63-
This component is licensed under {{ about_object.dje_license }}.
64-
</p>
65-
<p>Full text of
66-
<a class="{{ about_object.dje_license }}" href="#component-license-{{ about_object.dje_license }}">
67-
{{ about_object.dje_license }}
68-
</a>
69-
is available at the end of this document.</p>
70-
{% elif about_object.license_text_file in license_keys %}
71-
<p>Full text of
72-
<a class="{{ about_object.license_text_file }}" href="#component-license-{{ about_object.license_text_file }}">
73-
{{ about_object.license_text_file }}
74-
</a>
75-
is available at the end of this document.</p>
64+
65+
{% if about_object.dje_license in license_dicts.keys() %}
66+
{% if about_object.dje_license in common_licenses %}
67+
<p>Full text of
68+
<a class="{{ about_object.dje_license }}" href="#component-license-{{ about_object.dje_license }}">
69+
{{ about_object.dje_license }}
70+
</a>
71+
is available at the end of this document.</p>
72+
{% else %}
73+
<pre>{{ license_dicts[about_object.dje_license] }}</pre>
74+
{% endif %}
75+
{% elif about_object.license_text_file in license_dicts.keys() %}
76+
{% if about_object.dje_license in common_licenses %}
77+
<p>
78+
This component is licensed under {{ about_object.dje_license }}.
79+
</p>
80+
<p>Full text of
81+
<a class="{{ about_object.license_text_file }}" href="#component-license-{{ about_object.license_text_file }}">
82+
{{ about_object.license_text_file }}
83+
</a>
84+
is available at the end of this document.</p>
85+
{% else %}
86+
<pre>{{ license_dicts[about_object.license_text_file] }}</pre>
87+
{% endif %}
7688
{% endif %}
7789
</div>
7890
{% endfor %}
7991
<hr>
8092

8193
<h3>Licenses Used in This Product</h3>
8294
{% for index in range(license_keys | count) %}
83-
<h3 id="component-license-{{ license_keys[index] }}">{{ license_keys[index] }}</h3>
84-
<pre>{{ license_texts[index] }}</pre>
95+
{% if license_keys[index] in common_licenses %}
96+
<h3 id="component-license-{{ license_keys[index] }}">{{ license_keys[index] }}</h3>
97+
<pre>{{ license_texts[index] }}</pre>
98+
{% endif %}
8599
{% endfor %}
86100
<h3><a id="End">End</a></h3>
87101
</body>

0 commit comments

Comments
 (0)