From 65e96a57c7bc10dc42b234db2904a522e2265d44 Mon Sep 17 00:00:00 2001 From: Steve Eardley Date: Tue, 17 Oct 2023 14:40:01 +0100 Subject: [PATCH 1/2] some code suggestions from pycharm --- portality/bll/services/journal.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/portality/bll/services/journal.py b/portality/bll/services/journal.py index 24cbd22b5f..7cf286bba6 100644 --- a/portality/bll/services/journal.py +++ b/portality/bll/services/journal.py @@ -14,15 +14,15 @@ from portality.lib import dates from portality.lib.argvalidate import argvalidate from portality.lib.dates import FMT_DATETIME_SHORT -from portality.store import StoreFactory, prune_container +from portality.store import StoreFactory, prune_container, StoreException class JournalService(object): """ ~~Journal:Service~~ """ - - def journal_2_application(self, journal, account=None, keep_editors=False): + @staticmethod + def journal_2_application(journal, account=None, keep_editors=False): """ Function to convert a given journal into an application object. @@ -35,6 +35,7 @@ def journal_2_application(self, journal, account=None, keep_editors=False): :param journal: a journal to convert :param account: an account doing the action - optional, if specified the application will only be created if the account is allowed to + :param keep_editors: maintain the same editor assigned to the resulting application :return: Suggestion object """ @@ -86,18 +87,20 @@ def journal_2_application(self, journal, account=None, keep_editors=False): "Completed journal_2_application; return application object") return application - def journal(self, journal_id, lock_journal=False, lock_account=None, lock_timeout=None): + @staticmethod + def journal(journal_id, lock_journal=False, lock_account=None, lock_timeout=None): """ Function to retrieve a journal by its id, and to optionally lock the resource May raise a Locked exception, if a lock is requested but can't be obtained. :param journal_id: the id of the journal - :param: lock_journal: should we lock the resource on retrieval - :param: lock_account: which account is doing the locking? Must be present if lock_journal=True - :param: lock_timeout: how long to lock the resource for. May be none, in which case it will default - :return: Tuple of (Journal Object, Lock Object) + :param lock_journal: should we lock the resource on retrieval + :param lock_account: which account is doing the locking? Must be present if lock_journal=True + :param lock_timeout: how long to lock the resource for. May be none, in which case it will default + :return Tuple of (Journal Object, Lock Object) """ + # first validate the incoming arguments to ensure that we've got the right thing argvalidate("journal", [ {"arg": journal_id, "allow_none": False, "arg_name": "journal_id"}, @@ -126,10 +129,6 @@ def csv(self, prune=True, logger=None): Generate the Journal CSV ~~-> JournalCSV:Feature~~ - - :param set_cache: whether to update the cache - :param out_dir: the directory to output the file to. If set_cache is True, this argument will be overridden by the cache container - :return: Tuple of (attachment_name, URL) """ # first validate the incoming arguments to ensure that we've got the right thing argvalidate("csv", [ @@ -206,7 +205,7 @@ def usernames(j): sub = unmap[o] else: sub = "".join( - random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for i in + random.choice(string.ascii_lowercase + string.ascii_uppercase + string.digits) for _ in range(account_sub_length)) unmap[o] = sub return [("Owner", sub)] From edb2215648eaa08ad981039c871cb1df378286c2 Mon Sep 17 00:00:00 2001 From: Steve Eardley Date: Tue, 17 Oct 2023 14:43:40 +0100 Subject: [PATCH 2/2] reinstate edges version 261 --- portality/static/vendor/edges | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portality/static/vendor/edges b/portality/static/vendor/edges index 7350e42008..990f422016 160000 --- a/portality/static/vendor/edges +++ b/portality/static/vendor/edges @@ -1 +1 @@ -Subproject commit 7350e420087f89364e71b4431e3a3130d4d00c69 +Subproject commit 990f4220163a3e18880f0bdc3ad5c80d234d22dd