def set_script(self, script): """ Set the script @param script: @type script: str or pylastica.script.Script or dict @return: @rtype: self """ script = pylastica.script.Script.create(script) for param, value in script.to_dict().iteritems(): self.set_param(param, value) return self
def add_script(self, name, script): """ Add a script @param name: name of the script field @type name: str @param script: the script @type script: pylastica.script.Script @return: @rtype: self """ assert isinstance(name, str), "name must be a string: %r" % name assert len(name) > 0, "name must be set" return self.set_param(name, script.to_dict())