diff --git a/app/models/__init__.py b/app/models/__init__.py index 6034f4fb3..3a01e8a81 100644 --- a/app/models/__init__.py +++ b/app/models/__init__.py @@ -75,13 +75,8 @@ class ModelList(ABC, Sequence): def __add__(self, other): return list(self) + list(other) - -class EmptyModelList(ModelList): - - client_method = model = None - - def __init__(self, *args): - self.items = [] + def __radd__(self, other): + return list(other) + list(self) class InviteTokenError(Exception): diff --git a/app/models/service.py b/app/models/service.py index 0ee6217b0..132ac157c 100644 --- a/app/models/service.py +++ b/app/models/service.py @@ -5,7 +5,7 @@ from flask import abort, current_app from notifications_utils.timezones import local_timezone from werkzeug.utils import cached_property -from app.models import EmptyModelList, JSONModel +from app.models import JSONModel from app.models.job import ( ImmediateJobs, PaginatedJobs, @@ -123,13 +123,13 @@ class Service(JSONModel): @cached_property def immediate_jobs(self): if not self.has_jobs: - return EmptyModelList() + return [] return ImmediateJobs(self.id) @cached_property def scheduled_jobs(self): if not self.has_jobs: - return EmptyModelList() + return [] return ScheduledJobs(self.id) @cached_property