diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2014-10-19 14:23:16 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2014-10-20 13:22:08 +0300 |
commit | 3ec0d0b2038bb2bb00ad8c7060ffe64d4c2f8b51 (patch) | |
tree | ebd69f8ca1c95a9bc51b5c5510a8d68a9f7e98a1 /apscheduler/job.py | |
parent | 235fd14a70d855f5eccb167feccb573494883548 (diff) | |
download | apscheduler-3ec0d0b2038bb2bb00ad8c7060ffe64d4c2f8b51.tar.gz |
Raise exception when attempting to serialize a job that doesn't have func_ref filled in
Diffstat (limited to 'apscheduler/job.py')
-rw-r--r-- | apscheduler/job.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/apscheduler/job.py b/apscheduler/job.py index 7c2b3a4..f5639da 100644 --- a/apscheduler/job.py +++ b/apscheduler/job.py @@ -198,6 +198,12 @@ class Job(object): setattr(self, key, value) def __getstate__(self): + # Don't allow this Job to be serialized if the function reference could not be determined + if not self.func_ref: + raise ValueError('This Job cannot be serialized since the reference to its callable (%r) could not be ' + 'determined. Consider giving a textual reference (module:function name) instead.' % + (self.func,)) + return { 'version': 1, 'id': self.id, |