From 3ec0d0b2038bb2bb00ad8c7060ffe64d4c2f8b51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= Date: Sun, 19 Oct 2014 14:23:16 +0300 Subject: Raise exception when attempting to serialize a job that doesn't have func_ref filled in --- apscheduler/job.py | 6 ++++++ 1 file changed, 6 insertions(+) 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, -- cgit v1.2.1