Resolved issue113, avoiding a loophole in which the protection about @reloading a timed script could be circumvented.
This commit is contained in:
parent
3f703efc2d
commit
7eaf3d221c
3 changed files with 4 additions and 4 deletions
|
|
@ -92,8 +92,8 @@ class ScriptDB(TypedObject):
|
||||||
db_desc = models.CharField(max_length=255, blank=True)
|
db_desc = models.CharField(max_length=255, blank=True)
|
||||||
# A reference to the database object affected by this Script, if any.
|
# A reference to the database object affected by this Script, if any.
|
||||||
db_obj = models.ForeignKey(ObjectDB, null=True, blank=True)
|
db_obj = models.ForeignKey(ObjectDB, null=True, blank=True)
|
||||||
# how often to run Script (secs). 0 means there is no timer
|
# how often to run Script (secs). -1 means there is no timer
|
||||||
db_interval = models.IntegerField(default=0)
|
db_interval = models.IntegerField(default=-1)
|
||||||
# start script right away or wait interval seconds first
|
# start script right away or wait interval seconds first
|
||||||
db_start_delay = models.BooleanField(default=False)
|
db_start_delay = models.BooleanField(default=False)
|
||||||
# how many times this script is to be repeated, if interval!=0.
|
# how many times this script is to be repeated, if interval!=0.
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class ScriptClass(TypeClass):
|
||||||
|
|
||||||
def _start_task(self):
|
def _start_task(self):
|
||||||
"start the task runner."
|
"start the task runner."
|
||||||
if self.interval:
|
if self.interval > 0:
|
||||||
#print "Starting task runner"
|
#print "Starting task runner"
|
||||||
start_now = not self.start_delay
|
start_now = not self.start_delay
|
||||||
self.ndb.twisted_task = task.LoopingCall(self._step_task)
|
self.ndb.twisted_task = task.LoopingCall(self._step_task)
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ def reload_modules():
|
||||||
# these.
|
# these.
|
||||||
unsafe_modules = []
|
unsafe_modules = []
|
||||||
for scriptobj in ScriptDB.objects.get_all_scripts():
|
for scriptobj in ScriptDB.objects.get_all_scripts():
|
||||||
if scriptobj.interval and scriptobj.typeclass_path:
|
if (scriptobj.interval > -1) and scriptobj.typeclass_path:
|
||||||
unsafe_modules.append(scriptobj.typeclass_path)
|
unsafe_modules.append(scriptobj.typeclass_path)
|
||||||
unsafe_modules = list(set(unsafe_modules))
|
unsafe_modules = list(set(unsafe_modules))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue