def style_attribute(attribute_name, package):
mappings = {
'title': style_title,
'repo_description': style_repo_description,
'commits_over_52': style_commits,
}
as_var = template.Variable('package.' + attribute_name)
try:
value = as_var.resolve({'package': package})
except template.VariableDoesNotExist:
value = ''
if attribute_name in list(mappings.keys()):
return mappings[attribute_name](value)
return style_default(value)
评论列表
文章目录