Coverage for portality / ui / messages.py: 96%
135 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-04 09:41 +0100
« prev ^ index » next coverage.py v7.13.5, created at 2026-05-04 09:41 +0100
1from flask import flash
4class Messages(object):
5 ADMIN__QUICK_REJECT__NO_OWNER = """There is no user attached to this application.
6 <a href="https://testdoaj.cottagelabs.com/account/register" target="_blank">Assign a user account first</a>."""
8 PUBLISHER_APPLICATION_UPDATE_SUBMITTED_FLASH = ("""
9 Your update request has been submitted. You may make further changes until the DOAJ Editorial Team picks it up
10 for review. Click the 'Edit' button to make further changes or 'Delete' to cancel the request.
11 """, 'success')
12 PUBLISHER_UPLOAD_ERROR = """An error has occurred and your upload did not succeed. {error_str} <br \> If the problem persists, please send the error details from the Notes column of the History of Uploads box below and a screenshot of the entire error message"""
13 NO_FILE_UPLOAD_ID="""No file upload record has been specified"""
15 ARTICLE_METADATA_SUBMITTED_FLASH = ("<a href='{url}' target='_blank'>Article created/updated</a>", "success")
16 ARTICLE_METADATA_MERGE_CONFLICT = ("""Article could not be submitted, as it matches more than one existing article.
17 Please check your metadata, and contact us if you cannot resolve the issue yourself.""", "error")
18 ARTICLE_METADATA_UPDATE_CONFLICT = ("""Article could not be updated, as it matches another existing article.
19 Please check your metadata, and contact us if you cannot resolve the issue yourself.""", "error")
21 CONCURRENT_UPDATE_REQUEST = """You have submitted an Update Request for the same journal in a short period of time. If this is in error, you don't need to do anything, your first request is being processed. If this was intentional, please try again in a moment."""
23 SENT_ACCEPTED_APPLICATION_EMAIL = """Sent notification to '{user}' to tell them that their journal was accepted."""
24 SENT_REJECTED_APPLICATION_EMAIL_TO_OWNER = """Sent notification to user '{user}' to tell them that their journal application was rejected."""
25 SENT_ACCEPTED_UPDATE_REQUEST_EMAIL = """Sent notification to '{user}' to tell them that their journal update was accepted."""
26 SENT_REJECTED_UPDATE_REQUEST_EMAIL = """Sent email to user '{user}' ({name}, {email}) to tell them that their journal update was rejected."""
27 SENT_REJECTED_UPDATE_REQUEST_REVISIONS_REQUIRED_EMAIL = """Sent email to user '{user}' to tell them that their journal update requires revisions. You will need to contact them separately with details."""
28 SENT_JOURNAL_CONTACT_ACCEPTED_APPLICATION_EMAIL = """Sent email to journal contact '{email}' to tell them their journal was accepted."""
29 SENT_JOURNAL_CONTACT_ACCEPTED_UPDATE_REQUEST_EMAIL = """Sent email to journal contact '{email}' to tell that an update to their journal was accepted."""
30 SENT_JOURNAL_CONTACT_IN_PROGRESS_EMAIL = """An email has been sent to the Journal Contact alerting them that you are working on their application."""
31 SENT_JOURNAL_CONTACT_ASSIGNED_EMAIL = """An email has been sent to the Journal Contact alerting them that an editor has been assigned to their application."""
33 NOT_SENT_ACCEPTED_APPLICATION_EMAIL = """Did not send notification to '{user}' to tell them that their journal was accepted. Email may be disabled, or there is a problem with the email address."""
34 NOT_SENT_REJECTED_APPLICATION_EMAILS = """Did not send email to user '{user}' or application suggester to tell them that their journal was rejected Email may be disabled, or there is a problem with the email address."""
35 NOT_SENT_ACCEPTED_UPDATE_REQUEST_EMAIL = """Did not send notification to '{user}' to tell them that their update was accepted Email may be disabled, or there is a problem with the email address."""
36 NOT_SENT_REJECTED_UPDATE_REQUEST_EMAIL = """Did not send email to user '{user}' to tell them that their update was rejected. Email may be disabled, or there is a problem with the email address"""
37 NOT_SENT_REJECTED_UPDATE_REQUEST_REVISIONS_REQUIRED_EMAIL = """Did not send email to user '{user}' to tell them that their update required revisions. Email may be disabled, or there is a problem with the email address"""
38 NOT_SENT_JOURNAL_CONTACT_ACCEPTED_APPLICATION_EMAIL = """Did not send email to '{email}' to tell them that their application/update request was accepted. Email may be disabled, or there is a problem with the email address"""
39 NOT_SENT_JOURNAL_CONTACT_IN_PROGRESS_EMAIL = """An email could not be sent to the Journal Contact alerting them that you are working on their application. Email may be disabled, or there is a problem with the email address"""
40 NOT_SENT_JOURNAL_CONTACT_ASSIGNED_EMAIL = """An email could not be sent to the Journal Contact alerting them that an editor has been assigned to their application. Email may be disabled, or there is a problem with the email address"""
42 IN_PROGRESS_NOT_SENT_EMAIL_DISABLED = """Did not send email to Owner or Journal Contact about the status change, as publisher emails are disabled."""
44 DIFF_TABLE_NOT_PRESENT = """-- Not held in journal metadata --"""
46 REJECT_NOTE_WRAPPER = """{editor}: This application was rejected with the reason '{note}'"""
48 EXCEPTION_ARTICLE_BATCH_DUPLICATE = "One or more articles in this batch have duplicate identifiers"
49 EXCEPTION_ARTICLE_BATCH_FAIL = "One or more articles failed to ingest; entire batch ingest halted"
50 EXCEPTION_ARTICLE_BATCH_CONFLICT = "One or more articles in this batch matched multiple articles as duplicates; entire batch ingest halted"
51 EXCEPTION_DETECT_DUPLICATE_NO_ID = "The article you provided has neither doi nor fulltext URL, and as a result cannot be deduplicated"
52 EXCEPTION_ARTICLE_MERGE_CONFLICT = "The article matched multiple existing articles as duplicates, and we cannot tell which one to update"
53 EXCEPTION_NO_DOI_NO_FULLTEXT = "The article must have a DOI and/or a Full-Text URL"
54 EXCEPTION_ARTICLE_OVERRIDE = "Cannot update the article. An article with this URL and DOI already exists. If you are sure you want to replace it please delete it and then re-create it."
55 EXCEPTION_SCRIPT_TAG_FOUND = "Metadata contains <script> tag. Please remove any <script> tags from your metadata and try again."
56 EXCEPTION_ADDING_ARTICLE_TO_WITHDRAWN_JOURNAL = "You are trying to add the articles to a journal that has been withdrawn from DOAJ. We accept articles only for journals currently in DOAJ"
58 EXCEPTION_NO_CONTRIBUTORS_FOUND = "No contributors found."
59 EXCEPTION_NO_CONTRIBUTORS_EXPLANATION = "DOAJ requires at least one author for each article."
61 EXCEPTION_TOO_MANY_ISSNS = "Too many ISSNs. Only 2 ISSNs are allowed: one Print ISSN and one Online ISSN."
62 EXCEPTION_MISMATCHED_ISSNS = "ISSNs provided don't match any journal."
63 EXCEPTION_ISSNS_OF_THE_SAME_TYPE = "Both ISSNs have the same type: {type}"
64 EXCEPTION_IDENTICAL_PISSN_AND_EISSN = "The Print and Online ISSNs supplied are identical. If you supply two ISSNs, they must be different."
65 EXCEPTION_NO_ISSNS = "Neither the Print ISSN nor Online ISSN have been supplied. DOAJ requires at least one ISSN."
66 EXCEPTION_INVALID_BIBJSON = "Invalid article bibjson: " # + Dataobj exception message
68 EXCEPTION_IDENTIFIER_CHANGE_CLASH = "DOI or Fulltext URL has been changed to match another article that already exists in DOAJ"
69 EXCEPTION_IDENTIFIER_CHANGE = "Either the DOI or Fulltext URL has been changed. This operation is not permitted; please contact an administrator for help."
70 EXCEPTION_DUPLICATE_NO_PERMISSION = "You do not have permission to carry out the requested change"
72 EXCEPTION_EDITING_ACCEPTED_JOURNAL = "You cannot edit applications which have been accepted into DOAJ."
73 EXCEPTION_EDITING_WITHDRAWN_JOURNAL = "This journal has been withdrawn, update request cannot be accepted."
74 EXCEPTION_EDITING_DELETED_JOURNAL = "This journal has been deleted, update request cannot be accepted."
75 EXCEPTION_EDITING_NON_EXISTING_APPLICATION = "You cannot edit a not-existent application"
77 EXCEPTION_NOTIFICATION_NO_ACCOUNT = "Account with id {x} not found"
78 EXCEPTION_NOTIFICATION_NO_EMAIL = "Account with id {x} does not have an email address"
79 EXCEPTION_NOTIFICATION_NO_NOTIFICATION = "Notification with id {n} does not exist"
81 PREVENT_DEEP_PAGING_IN_API = """You cannot access results beyond {max_records} records via this API.
82 If you would like to see more results, you can download all of our data from
83 {data_dump_url}. You can also harvest from our OAI-PMH endpoints; articles: {oai_article_url}, journals: {oai_journal_url}"""
85 FORMS__APPLICATION_PROCESSORS__NEW_APPLICATION__FINALISE__USER_EMAIL_ERROR = "We were unable to send you an email confirmation - possible problem with the email address provided"
86 FORMS__APPLICATION_PROCESSORS__NEW_APPLICATION__FINALISE__LOG_EMAIL_ERROR = 'Error sending application received email.'
87 FORMS__APPLICATION_PROCESSORS__ADMIN_APPLICATION__FINALISE__COULD_NOT_UNREJECT = "Could not unreject application, as a new Update Request for the journal now exists"
88 FORMS__APPLICATION_PROCESSORS__ASSOCIATE_APPLICATION__FINALISE__STATUS_COMPLETED_NOTIFIED = "A confirmation email has been sent to notify the editor of the change in status."
90 BLL__UNREJECT_APPLICATION__NO_APPLICATION = "You must supply an application to unreject_application"
91 BLL__UNREJECT_APPLICATION__NO_ACCOUNT = "You must supply an account to unreject_application"
92 BLL__UNREJECT_APPLICATION__WRONG_ROLE = "This user is not allowed to unreject applications"
93 BLL__UNREJECT_APPLICATION__ILLEGAL_STATE_REJECTED = "The application {id} is in 'rejected' state; place it into the correct new state before calling unreject_application"
94 BLL__UNREJECT_APPLICATION__ILLEGAL_STATE_DISALLOWED = "The application {id} is in '{x}' status, which is disallowed in this call context"
95 BLL__UNREJECT_APPLICATION__DUPLICATE_UR = """Creating an update request from rejected application {id} is not possible as another application {urid} exists which is an update request for journal {jid}"""
96 BLL__UNREJECT_APPLICATION__JOURNAL_MISSING = "Journal {jid} related to application {id} does not exist"
97 BLL__UNREJECT_APPLICATION__SAVE_FAIL = "Save on {obj} {id} in unreject_application failed"
99 ADMIN__WITHDRAW_REINSTATE = "<a href='{url}'>Job to withdraw/reinstate journal has been submitted</a>"
101 CANNOT_CHANGE_THE_STATUS__OTHER_JOURNAL_IN_DOAJ_EXISTS = "The journal could not be reinstated because at least one other record with matching ISSN(s) already exists in DOAJ"
103 AUTOMATICALLY_REJECTED_UPDATE_REQUEST_NOTE = "Update request was automatically rejected because the associated journal was withdrawn or deleted."
104 AUTOMATICALLY_REJECTED_UPDATE_REQUEST_WITH_ID = "Update request {urid} automatically rejected"
105 NO_UPDATE_REQUESTS = "No update requests found."
107 LAST_FULL_REVIEW_NOTE = "Last full review completed on {date} by `{username}`"
108 OWNER_CHANGED_NOTE = "Owner changed from `{old_owner}` to `{new_owner}` by `{changed_by}` on {date}"
109 JOURNAL_REINSTATED_NOTE = "Journal reinstated into DOAJ by `{username}` on {date}."
110 JOURNAL_WITHDRAWN_NOTE = "Journal withdrawn from DOAJ by `{username}` on {date}."
112 BULK_JOURNAL_DELETE = "About to delete an estimated {journal_no} journals with {article_no} articles associated with their ISSNs. Existing update requests will be automatically rejected."
113 BULK_JOURNAL_DELETE_COMPLETED = "Deleted {journal_no} journals and all articles associated with their ISSNs."
115 NOTIFY__DEFAULT_SHORT_NOTIFICATION = "You have a new notification"
116 NOTIFY__DEFAULT_ACTION_INTRO = "To take action based on this notification, follow this link: "
118 DISCONTINUED_JOURNAL_FOUND_LOG = "Journal discontinuing soon found: {id}"
119 DISCONTINUED_JOURNALS_FOUND_NOTIFICATION_SENT_LOG = "Notification with journals discontinuing soon sent."
120 DISCONTINUED_JOURNALS_FOUND_NOTIFICATION_ERROR_LOG = "Error sending notification with journals discontinuing soon."
121 NO_DISCONTINUED_JOURNALS_FOUND_LOG = "No journals discontinuing soon found"
123 FORMS__APPLICATION_STATUS__PENDING = "Pending"
124 FORMS__APPLICATION_STATUS__IN_PROGRESS = 'In Progress'
125 FORMS__APPLICATION_STATUS__COMPLETED = 'Completed'
126 FORMS__APPLICATION_STATUS__POST_SUBMISSION_REVIEW = 'Post Submission Automation'
127 FORMS__APPLICATION_STATUS__UPDATE_REQUEST = 'Update Request'
128 FORMS__APPLICATION_STATUS__REVISIONS_REQUIRED = 'Revisions Required'
129 FORMS__APPLICATION_STATUS__ON_HOLD = 'On Hold'
130 FORMS__APPLICATION_STATUS__READY = 'Ready'
131 FORMS__APPLICATION_STATUS__REJECTED = 'Rejected'
132 FORMS__APPLICATION_STATUS__ACCEPTED = 'Accepted'
134 JOURNAL_CSV_VALIDATE__HEADER_CASE_MISMATCH = '"{h}" has a mismatching case to the expected header "{expected}".'
135 JOURNAL_CSV_VALIDATE__INVALID_HEADER = '"{h}" is not a valid column header. Please revert it to match what was sent to you in the original file.'
136 JOURNAL_CSV_VALIDATE__REQUIRED_HEADER_MISSING = '"{h}" is a required column missing from this upload. Please refer to the original file and restore the column.'
137 JOURNAL_CSV_VALIDATE__MISSING_JOURNAL = "There is no journal record in DOAJ for ISSN(s) {issns}. The record may not exist, or it may be withdrawn."
138 JOURNAL_CSV_VALIDATE__OWNER_MISMATCH = "Your account '{acc}' doesn't own the journal with ISSN(s) {issns}. You may not update it."
139 JOURNAL_CSV_VALIDATE__NO_DATA_CHANGE = "The data you supplied didn't change anything in the journal record."
140 JOURNAL_CSV_VALIDATE__QUESTION_CANNOT_CHANGE = 'You may not change "{question}". Please revert it to match what was sent to you in the original file.'
141 JOURNAL_CSV_VALIDATE__CANNOT_MAKE_UR = "We couldn't create an update for this journal because: {reason}"
142 JOURNAL_CSV_VALIDATE__INVALID_DATA = "We couldn't understand the information in '{question}'"
144 PRESERVATION_NO_FILE = "No file provided for upload"
146 ARE_YOU_A_HUMAN = "Are you sure you're a human? If you're having trouble logging in, please <a href='/contact'>contact us</a>."
148 AUTOASSIGN__OWNER_MAPPED = "owner '{owner}' is mapped to editor group '{target}'"
149 AUTOASSIGN__COUNTRY_MAPPED = "country '{country}' ({country_code}) is mapped to editor group '{target}'"
150 AUTOASSIGN__NOTE__EDITOR_GROUP_MISSING = "Autoassign: Editor group '{target}' does not exist, cannot auto assign"
151 AUTOASSIGN__NOTE__ASSIGN = "Autoassign: Editor group auto assigned to '{target}' because {reason}"
153 FORMS__APPLICATION_FLAG__RESOLVED = "This flag was resolved on {date} by {username};\n Original note: {note}"
154 FORMS_APPLICATION_FLAG__PAST_DEADLINE_WARNING = "Provided deadline is in the past. Is it correct?"
156 ARTICLE_BELONGS_TO_TOO_MANY_JOURNALS = "Article found that belongs to more than 1 journal. Article's id: {article_id}"
157 ARTICLE_ABANDONED_LOG = """An article was found that doesn't seem to match any journal articles\'s id: {article.id}"""
158 ARTICLE_ABANDONED_PUBLIC = """This article doesn't seem to match any journal in our database. If you think this is wrong, contact us quoting 'Abandoned article: {article.id}'"""
159 ARTICLE_NOT_FOUND = "We couldn't find this article"
161 TOO_MANY_JOURNALS = """This identifier seems to match more than one journal. Please contact us quoting 'More than one journal found with identifier: {identifier}'"""
162 TOO_MANY_JOURNALS_LOG = """More than one journal found with identifier: {identifier}'"""
164 DEFAULT_500_DESCRIPTION = "An error has occurred. It looks like something has gone wrong."
166 @classmethod
167 def flash(cls, tup):
168 if isinstance(tup, tuple):
169 flash(tup[0], tup[1])
170 else:
171 flash(tup)
173 @classmethod
174 def flash_with_url(cls, message, category):
175 flash(message, category + '+contains-url')
177 @classmethod
178 def flash_with_param(cls, message, category="error", **kwargs):
179 for key, value in kwargs.items():
180 if key != "message" or key != "category":
181 message = message + (" {0}: {1},".format(key, value))
182 flash(message, category)