Skip to content

Commit fc09e1b

Browse files
committed
Fixed #126 - The error is now returning name instead of resource
1 parent 8733464 commit fc09e1b

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

about_code_tool/about.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,6 @@ def get_dje_license_name(self):
959959
return self.parsed['dje_license_name']
960960
except Exception as e:
961961
pass
962-
963962
return ""
964963

965964
def get_license_text_file_name(self):
@@ -970,7 +969,16 @@ def get_license_text_file_name(self):
970969
return self.parsed['license_text_file']
971970
except Exception as e:
972971
pass
972+
return ""
973973

974+
def get_about_name(self):
975+
"""
976+
Return the about object's name
977+
"""
978+
try:
979+
return self.parsed['name']
980+
except Exception as e:
981+
pass
974982
return ""
975983

976984
class AboutCollector(object):
@@ -1144,9 +1152,9 @@ def generate_attribution(self, template_path=None, limit_to=None):
11441152
if about_object.license_text():
11451153
license_dict[about_object.get_dje_license_name()] = unicode(about_object.license_text(), errors='replace')
11461154
else:
1147-
msg = 'About resource: %s - license_text does not exist.'\
1155+
msg = 'Name: %s - license_text does not exist.'\
11481156
' License generation is skipped.'\
1149-
% about_object.about_resource
1157+
% about_object.get_about_name()
11501158
self.genattrib_errors.append(Error(GENATTRIB,\
11511159
'dje_license',\
11521160
dje_license_name, msg))
@@ -1155,16 +1163,16 @@ def generate_attribution(self, template_path=None, limit_to=None):
11551163
if about_object.license_text():
11561164
license_dict[about_object.get_license_text_file_name()] = unicode(about_object.license_text(), errors='replace')
11571165
else:
1158-
msg = 'About resource: %s - license_text does not exist.'\
1166+
msg = 'Name: %s - license_text does not exist.'\
11591167
' License generation is skipped.'\
1160-
% about_object.about_resource
1168+
% about_object.get_about_name()
11611169
self.genattrib_errors.append(Error(GENATTRIB,\
11621170
'license_text',\
11631171
about_object.get_license_text_file_name(), msg))
11641172
else:
11651173
msg = 'No dje_license or license_text is found. License generation is skipped.'
1166-
self.genattrib_errors.append(Error(GENATTRIB, 'about_resource',\
1167-
about_object.about_resource,\
1174+
self.genattrib_errors.append(Error(GENATTRIB, 'name',\
1175+
about_object.get_about_name(),\
11681176
msg))
11691177

11701178
if not_exist_components:

about_code_tool/tests/test_genabout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ def test_write_licenses(self):
517517

518518
def test_process_dje_licenses(self):
519519
gen = genabout.GenAbout()
520-
test_license_list = [('/', [u'test'])]
520+
test_license_list = [('/', 'test')]
521521
test_license_dict = {'test': [u'test_key', u'This is a test license.']}
522522
test_path = '/test'
523523
expected_output = [[join(u'/test', 'test_key.LICENSE'), 'This is a test license.']]

0 commit comments

Comments
 (0)