Coverage for portality/ui/messages.py: 94%

89 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-08-04 15:38 +0100

1from flask import flash 

2 

3 

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>.""" 

7 

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 may not have succeeded. If the problem persists please report the issue with the ID", 'error') 

13 

14 ARTICLE_METADATA_SUBMITTED_FLASH = ("<a href='{url}' target='_blank'>Article created/updated</a>", "success") 

15 ARTICLE_METADATA_MERGE_CONFLICT = ("""Article could not be submitted, as it matches more than one existing article. 

16 Please check your metadata, and contact us if you cannot resolve the issue yourself.""", "error") 

17 ARTICLE_METADATA_UPDATE_CONFLICT = ("""Article could not be updated, as it matches another existing article. 

18 Please check your metadata, and contact us if you cannot resolve the issue yourself.""", "error") 

19 

20 SENT_ACCEPTED_APPLICATION_EMAIL = """Sent notification to '{user}' to tell them that their journal was accepted.""" 

21 SENT_REJECTED_APPLICATION_EMAIL_TO_OWNER = """Sent notification to user '{user}' to tell them that their journal application was rejected.""" 

22 SENT_ACCEPTED_UPDATE_REQUEST_EMAIL = """Sent notification to '{user}' to tell them that their journal update was accepted.""" 

23 SENT_REJECTED_UPDATE_REQUEST_EMAIL = """Sent email to user '{user}' ({name}, {email}) to tell them that their journal update was rejected.""" 

24 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.""" 

25 SENT_JOURNAL_CONTACT_ACCEPTED_APPLICATION_EMAIL = """Sent email to journal contact '{email}' to tell them their journal was accepted.""" 

26 SENT_JOURNAL_CONTACT_ACCEPTED_UPDATE_REQUEST_EMAIL = """Sent email to journal contact '{email}' to tell that an update to their journal was accepted.""" 

27 SENT_JOURNAL_CONTACT_IN_PROGRESS_EMAIL = """An email has been sent to the Journal Contact alerting them that you are working on their application.""" 

28 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.""" 

29 SENT_PUBLISHER_IN_PROGRESS_EMAIL = """An email has been sent to the Owner alerting them that you are working on their application.""" 

30 SENT_PUBLISHER_ASSIGNED_EMAIL = """A notification has been sent to the Owner alerting them that an editor has been assigned to their application.""" 

31 

32 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.""" 

33 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.""" 

34 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.""" 

35 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""" 

36 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""" 

37 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""" 

38 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""" 

39 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""" 

40 NOT_SENT_PUBLISHER_IN_PROGRESS_EMAIL = """An email could not be sent to the Owner alerting them that you are working on their application. Email may be disabled, or there is a problem with the email address. """ 

41 NOT_SENT_PUBLISHER_ASSIGNED_EMAIL = """An email could not be sent to the Owner 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 

43 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 

45 DIFF_TABLE_NOT_PRESENT = """-- Not held in journal metadata --""" 

46 

47 REJECT_NOTE_WRAPPER = """{editor}: This application was rejected with the reason '{note}'""" 

48 

49 EXCEPTION_ARTICLE_BATCH_DUPLICATE = "One or more articles in this batch have duplicate identifiers" 

50 EXCEPTION_ARTICLE_BATCH_FAIL = "One or more articles failed to ingest; entire batch ingest halted" 

51 EXCEPTION_ARTICLE_BATCH_CONFLICT = "One or more articles in this batch matched multiple articles as duplicates; entire batch ingest halted" 

52 EXCEPTION_DETECT_DUPLICATE_NO_ID = "The article you provided has neither doi nor fulltext url, and as a result cannot be deduplicated" 

53 EXCEPTION_ARTICLE_MERGE_CONFLICT = "The article matched multiple existing articles as duplicates, and we cannot tell which one to update" 

54 EXCEPTION_NO_DOI_NO_FULLTEXT = "The article must have a DOI and/or a Full-Text URL" 

55 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." 

56 EXCEPTION_SCRIPT_TAG_FOUND = "Metadata contains <script> tag. Please remove any <script> tags from your metadata and try again." 

57 

58 EXCEPTION_NO_CONTRIBUTORS_FOUND = "No contributors found." 

59 EXCEPTION_NO_CONTRIBUTORS_EXPLANATION = "DOAJ requires at least one author for each article." 

60 

61 EXCEPTION_TOO_MANY_ISSNS = "Too many ISSNs. Only 2 ISSNs are allowed: one Print ISSN and one Online ISSN." 

62 EXCEPTION_ISSNS_OF_THE_SAME_TYPE = "Both ISSNs have the same type: {type}" 

63 EXCEPTION_IDENTICAL_PISSN_AND_EISSN = "The Print and Online ISSNs supplied are identical. If you supply 2 ISSNs they must be different." 

64 

65 EXCEPTION_IDENTIFIER_CHANGE_CLASH = "DOI or Fulltext URL has been changed to match another article that already exists in DOAJ" 

66 EXCEPTION_IDENTIFIER_CHANGE = "DOI or Fulltext URL have been changed. This operation is not permitted, please contact an administrator for help." 

67 EXCEPTION_DUPLICATE_NO_PERMISSION = "You do not have the permissions to carry out the requested change" 

68 

69 EXCEPTION_EDITING_ACCEPTED_JOURNAL = "You cannot edit applications which have been accepted into DOAJ." 

70 EXCEPTION_EDITING_WITHDRAWN_JOURNAL = "This journal has been withdrawn, update request cannot be accepted." 

71 EXCEPTION_EDITING_DELETED_JOURNAL = "This journal has been deleted, update request cannot be accepted." 

72 EXCEPTION_EDITING_NON_EXISTING_APPLICATION = "You cannot edit a not-existent application" 

73 

74 EXCEPTION_NOTIFICATION_NO_ACCOUNT = "Account with id {x} not found" 

75 EXCEPTION_NOTIFICATION_NO_EMAIL = "Account with id {x} does not have an email address" 

76 

77 PREVENT_DEEP_PAGING_IN_API = """You cannot access results beyond {max_records} records via this API. 

78 If you would like to see more results, you can download all of our data from 

79 {data_dump_url}. You can also harvest from our OAI-PMH endpoints; articles: {oai_article_url}, journals: {oai_journal_url}""" 

80 

81 CONSENT_COOKIE_VALUE = """By using the DOAJ website you have agreed to our cookie policy.""" 

82 

83 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" 

84 FORMS__APPLICATION_PROCESSORS__NEW_APPLICATION__FINALISE__LOG_EMAIL_ERROR = 'Error sending application received email.' 

85 FORMS__APPLICATION_PROCESSORS__ADMIN_APPLICATION__FINALISE__COULD_NOT_UNREJECT = "Could not unreject application, as a new Update Request for the journal now exists" 

86 FORMS__APPLICATION_PROCESSORS__ASSOCIATE_APPLICATION__FINALISE__STATUS_COMPLETED_NOTIFIED = "A confirmation email has been sent to notify the editor of the change in status." 

87 

88 BLL__UNREJECT_APPLICATION__NO_APPLICATION = "You must supply an application to unreject_application" 

89 BLL__UNREJECT_APPLICATION__NO_ACCOUNT = "You must supply an account to unreject_application" 

90 BLL__UNREJECT_APPLICATION__WRONG_ROLE = "This user is not allowed to unreject applications" 

91 BLL__UNREJECT_APPLICATION__ILLEGAL_STATE_REJECTED = "The application {id} is in 'rejected' state; place it into the correct new state before calling unreject_application" 

92 BLL__UNREJECT_APPLICATION__ILLEGAL_STATE_DISALLOWED = "The application {id} is in '{x}' status, which is disallowed in this call context" 

93 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}""" 

94 BLL__UNREJECT_APPLICATION__JOURNAL_MISSING = "Journal {jid} related to application {id} does not exist" 

95 BLL__UNREJECT_APPLICATION__SAVE_FAIL = "Save on {obj} {id} in unreject_application failed" 

96 

97 ADMIN__WITHDRAW_REINSTATE = "<a href='{url}'>Job to withdraw/reinstate journal has been submitted</a>" 

98 

99 AUTOMATICALLY_REJECTED_UPDATE_REQUEST_NOTE = "Update request was automatically rejected because the associated journal was withdrawn or deleted." 

100 AUTOMATICALLY_REJECTED_UPDATE_REQUEST_WITH_ID = "Update request {urid} automatically rejected" 

101 NO_UPDATE_REQUESTS = "No update requests found." 

102 

103 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." 

104 BULK_JOURNAL_DELETE_COMPLETED = "Deleted {journal_no} journals and all articles associated with their ISSNs." 

105 

106 NOTIFY__DEFAULT_SHORT_NOTIFICATION = "You have a new notification" 

107 

108 @classmethod 

109 def flash(cls, tup): 

110 if isinstance(tup, tuple): 

111 flash(tup[0], tup[1]) 

112 else: 

113 flash(tup) 

114 

115 @classmethod 

116 def flash_with_url(cls, message, category): 

117 flash(message, category + '+contains-url') 

118 

119 @classmethod 

120 def flash_with_param(cls, message, category="error", **kwargs): 

121 for key, value in kwargs.items(): 

122 if key != "message" or key != "category": 

123 message = message + (" {0}: {1},".format(key, value)) 

124 flash(message, category)