Skip to content

Commit 5d26b07

Browse files
committed
Set license_name_expression as a custom field
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent cfb194d commit 5d26b07

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/attributecode/attrib.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from attributecode import Error
2828
from attributecode.licenses import COMMON_LICENSES
2929
from attributecode.model import parse_license_expression
30-
from attributecode.model import License
30+
from attributecode.model import License, StringField
3131
from attributecode.util import add_unc
3232
from attributecode.attrib_util import multi_sort
3333

@@ -171,9 +171,9 @@ def generate(abouts, is_about_input, license_dict, scancode, min_license_score,
171171
# Join the license name expression into a single string
172172
lic_name_expression = ' '.join(lic_name_expression_list)
173173

174-
# Add the license name expression string into the about object as a list
175-
about.license_name_expression.value = lic_name_expression
176-
about.license_name_expression.present = True
174+
# Add the license name expression string into the about object as a custom field
175+
custom_field = StringField(name=name, value=lic_name_expression, present=True)
176+
setattr(about, 'license_name_expression', custom_field)
177177

178178
# Sort the about objects by name
179179
abouts = sorted(abouts, key=lambda x: x.name.value.lower())

src/attributecode/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ def set_standard_fields(self):
774774
('notes', StringField()),
775775

776776
('license_expression', StringField()),
777-
('license_name_expression', StringField()),
778777
('license_key', ListField()),
779778
('license_name', ListField()),
780779
('license_file', FileTextField()),

0 commit comments

Comments
 (0)