-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle missing contact address in project_submission (#2178)
Pull #2156 introduced the PROJECT_EDITOR_EMAIL setting. If this setting is not defined (or blank) then we want to fall back to the old behavior of showing the assigned editor's email address. However, if the project has not yet been assigned to an editor, and PROJECT_EDITOR_EMAIL is blank, it would crash. (For example, clear the PROJECT_EDITOR_EMAIL setting, then log in as rgmark and try to submit the "MIMIC-III Clinical Database" project.)
- Loading branch information
Showing
2 changed files
with
24 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,29 @@ def has_wfdb(self): | |
""" | ||
return self.files.has_wfdb_files(self) | ||
|
||
@property | ||
def editor_contact_email(self): | ||
""" | ||
Email address for contacting the project editor. | ||
If a site-wide contact address is configured, that address | ||
will be used for all projects. The string PROJECT-SLUG can be | ||
included and will be replaced by the active project slug (for | ||
example, PROJECT_EDITOR_EMAIL can be set to | ||
'[email protected]', if the mail server | ||
understands how to handle it.) | ||
If there is no site-wide contact address, the primary email | ||
address of the assigned editor is used. | ||
""" | ||
if not self.editor: | ||
return None | ||
elif settings.PROJECT_EDITOR_EMAIL: | ||
return settings.PROJECT_EDITOR_EMAIL.replace('PROJECT-SLUG', | ||
self.slug) | ||
else: | ||
return self.editor.email | ||
|
||
def content_modified(self): | ||
""" | ||
Update the project's modification timestamp. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters