Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
teovin committed May 16, 2024
1 parent e15d90d commit eda8624
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions web/main/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1655,33 +1655,40 @@ def export_content(self, request):
elif self.resource_type == "TextBlock":
return rich_text_export(self.resource.content, request=request, id_prefix=str(self.id))
return self.resource.content

def get_ali_license_text(self) -> str:
licensed_materials = [
{
"title": "Restatements of the Law",
"copyright_year": 2014,
"match_words": ["restatement", "restatements", "contracts", "restatements of the law"]
"match_words": [
"restatement",
"restatements",
"contracts",
"restatements of the law",
],
},
{
"title": "Principles of the Law",
"copyright_year": 2015,
"match_words": ["principle", "principles", "principles of the law"]
"match_words": ["principle", "principles", "principles of the law"],
},
{
"title": "Model Penal Code",
"copyright_year": 2016,
"match_words": ["model penal code", "mpc"]
}
"match_words": ["model penal code", "mpc"],
},
]

license_txt = ''
license_txt = ""
title = self.title.lower()

for item in licensed_materials:
if any(word.lower() in title.split() for word in item["match_words"]):
license_txt = (f"{item['title']}, copyright @ {item['copyright_year']} by the American Law Institute. "
f"Reproduced with permission, not as part of a Creative Commons license.")
license_txt = (
f"{item['title']}, copyright @ {item['copyright_year']} by the American Law Institute. "
f"Reproduced with permission, not as part of a Creative Commons license."
)
return license_txt

@property
Expand Down

0 comments on commit eda8624

Please sign in to comment.