Merge pull request #126 from dirtbags/fix_authors_check

Fixing issue with detecting which authors/author field to use
This commit is contained in:
int00h5525 2020-01-29 18:06:03 -06:00 committed by GitHub
commit 3d15c581f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- URL parameter to points.json to allow returning only the JSON for a single - URL parameter to points.json to allow returning only the JSON for a single
team by its team id (e.g., points.json?id=abc123). team by its team id (e.g., points.json?id=abc123).
### Fixed ### Fixed
- Handle cases where non-legacy puzzles don't have an `author` attribute
- Handle YAML-formatted file and script lists as expected - Handle YAML-formatted file and script lists as expected
- YAML-formatted example puzzle actually works as expected - YAML-formatted example puzzle actually works as expected

View File

@ -412,7 +412,12 @@ class Puzzle:
self.body.write('</pre>') self.body.write('</pre>')
def get_authors(self): def get_authors(self):
return self.authors or [self.author] if len(self.authors) > 0:
return self.authors
elif hasattr(self, "author"):
return [self.author]
else:
return []
def get_body(self): def get_body(self):
return self.body.getvalue() return self.body.getvalue()