mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Fix merge conflicts
This commit is contained in:
commit
2478698216
1 changed files with 13 additions and 13 deletions
|
|
@ -292,14 +292,25 @@ class TaskHandler(object):
|
|||
if not persistent:
|
||||
continue
|
||||
|
||||
safe_callback = callback
|
||||
if getattr(callback, "__self__", None):
|
||||
# `callback` is an instance method
|
||||
obj = callback.__self__
|
||||
name = callback.__name__
|
||||
callback = (obj, name)
|
||||
safe_callback = (obj, name)
|
||||
|
||||
# Check if callback can be pickled. args and kwargs have been checked
|
||||
self.to_save[task_id] = dbserialize((date, callback, args, kwargs))
|
||||
try:
|
||||
dbserialize(safe_callback)
|
||||
except (TypeError, AttributeError, PickleError) as err:
|
||||
raise ValueError(
|
||||
"the specified callback {callback} cannot be pickled. "
|
||||
"It must be a top-level function in a module or an "
|
||||
"instance method ({err}).".format(callback=callback, err=err)
|
||||
)
|
||||
|
||||
self.to_save[task_id] = dbserialize((date, safe_callback, args, kwargs))
|
||||
|
||||
ServerConfig.objects.conf("delayed_tasks", self.to_save)
|
||||
|
||||
def add(self, timedelay, callback, *args, **kwargs):
|
||||
|
|
@ -348,17 +359,6 @@ class TaskHandler(object):
|
|||
safe_args = []
|
||||
safe_kwargs = {}
|
||||
|
||||
# an unsaveable callback should immediately abort
|
||||
try:
|
||||
dbserialize(callback)
|
||||
except (TypeError, AttributeError, PickleError) as err:
|
||||
raise ValueError(
|
||||
"the specified callback {callback} cannot be pickled. "
|
||||
"It must be a top-level function in a module or an "
|
||||
"instance method ({err}).".format(callback=callback, err=err)
|
||||
)
|
||||
return
|
||||
|
||||
# Check that args and kwargs contain picklable information
|
||||
for arg in args:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue