Fixing issue with detecting which authors/author field to use

This commit is contained in:
John Donaldson 2020-01-29 20:30:55 +00:00
parent 8809580355
commit d6818dc409
2 changed files with 8 additions and 1 deletions

View File

@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- 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
- Handle cases where non-legacy puzzles don't have an `author` attribute
## [3.4.3] - 2019-11-20 ## [3.4.3] - 2019-11-20
### Fixed ### Fixed

View File

@ -384,7 +384,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()