arxiv.submission.core module¶
Core persistence methods for submissions and submission events.
-
arxiv.submission.core.
init_app
(app)[source]¶ Set default configuration parameters for an application instance.
- Return type
None
-
arxiv.submission.core.
load
(submission_id)[source]¶ Load a submission and its history.
This loads all events for the submission, and generates the most up-to-date representation based on those events.
- Parameters
submission_id (str) – Submission identifier.
- Return type
Tuple
[Submission
,List
[Event
]]- Returns
domain.submission.Submission
– The current state of the submission.list – Items are
Event
instances, in order of their occurrence.
- Raises
arxiv.submission.exceptions.NoSuchSubmission – Raised when a submission with the passed ID cannot be found.
-
arxiv.submission.core.
load_fast
(submission_id)[source]¶ Load a
domain.submission.Submission
from its projected state.This does not load and apply past events. The most recent stored submission state is loaded directly from the database.
- Parameters
submission_id (str) – Submission identifier.
- Return type
- Returns
domain.submission.Submission
– The current state of the submission.
-
arxiv.submission.core.
load_submissions_for_user
(user_id)[source]¶ Load active
domain.submission.Submission
for a specific user.- Parameters
user_id (int) – Unique identifier for the user.
- Return type
- Returns
list – Items are
domain.submission.Submission
instances.
-
arxiv.submission.core.
save
(*events, submission_id=None)[source]¶ Commit a set of new
Event
instances for a submission.This will persist the events to the database, along with the final state of the submission, and generate external notification(s) on the appropriate channels.
- Parameters
events (
Event
) – Events to apply and persist.submission_id (int) – The unique ID for the submission, if available. If not provided, it is expected that
events
includes aCreateSubmission
.
- Return type
Tuple
[Submission
,List
[Event
]]- Returns
arxiv.submission.domain.submission.Submission
– The state of the submission after all events (including rule-derived events) have been applied. Updated with the submission ID, if aCreateSubmission
was included.list – A list of
Event
instances applied to the submission. Note that this list may contain more events than were passed, if event rules were triggered.
- Raises
arxiv.submission.exceptions.NoSuchSubmission – Raised if
submission_id
is not provided and the first event is not aCreateSubmission
, orsubmission_id
is provided but no such submission exists.InvalidEvent – If an invalid event is encountered, the entire operation is aborted and this exception is raised.
SaveError – There was a problem persisting the events and/or submission state to the database.