Multiple fixes and cleanups - command parser excludes inaccessible commands already at parse level now. Fixed the functionality of a few of the lock functions to be more intuitive. Added functionality to the examine command to better show the commands available to an object.

This commit is contained in:
Griatch 2011-06-26 14:35:02 +00:00
parent 334c0b1d08
commit 95d672763b
17 changed files with 207 additions and 165 deletions

View file

@ -47,11 +47,13 @@ class ScriptHandler(object):
def add(self, scriptclass, key=None, autostart=True):
"""
Add an script to this object. The scriptclass
argument can be either a class object
inheriting from Script, an instantiated script object
or a python path to such a class object.
Add an script to this object.
scriptclass - either a class object
inheriting from Script, an instantiated script object
or a python path to such a class object.
key - optional identifier for the script (often set in script definition)
autostart - start the script upon adding it
"""
script = create.create_script(scriptclass, key=key, obj=self.obj, autostart=autostart)
if not script:

View file

@ -123,16 +123,19 @@ class ScriptClass(TypeClass):
#print "... Start cancelled (invalid start or already running)."
return 0 # this is used by validate() for counting started scripts
def stop(self):
def stop(self, kill=False):
"""
Called to stop the script from running.
This also deletes the script.
kill - don't call finishing hooks.
"""
#print "stopping script %s" % self.key
try:
self.at_stop()
except Exception:
logger.log_trace()
if not kill:
try:
self.at_stop()
except Exception:
logger.log_trace()
if self.interval:
try:
self._stop_task()