Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions django_celery_beat/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@

import timezone_field
from celery import current_app, schedules
from cron_descriptor import (FormatException, MissingFieldException,
WrongArgumentException, get_description)

try:
from cron_descriptor import (FormatError, MissingFieldError,
WrongArgumentError, get_description)
except ImportError:
from cron_descriptor import FormatException as FormatError
from cron_descriptor import MissingFieldException as MissingFieldError
from cron_descriptor import WrongArgumentException as WrongArgumentError

from django.conf import settings
from django.core.exceptions import MultipleObjectsReturned, ValidationError
from django.core.validators import MaxValueValidator, MinValueValidator
Expand Down Expand Up @@ -340,9 +347,9 @@ def human_readable(self):
try:
human_readable = get_description(cron_expression)
except (
MissingFieldException,
FormatException,
WrongArgumentException
MissingFieldError,
FormatError,
WrongArgumentError
):
return f'{cron_expression} {str(self.timezone)}'
return f'{human_readable} {str(self.timezone)}'
Expand Down
Loading