def getScript(self, context): # Generate Python script object body = self.ScriptBody role = self.ProxyRole script = PythonScript(self.__name__) script = script.__of__(context) # Skip check roles script._validateProxy = lambda i=None: None # Force proxy role if role != u'none': script.manage_proxy((role,)) body = body.encode('utf-8') params = 'fields, easyform, request' script.ZPythonScript_edit(params, body) return script
def getScript(self, context): # Generate Python script object body = self.ScriptBody role = self.ProxyRole script = PythonScript(self.__name__) script = script.__of__(context) # Skip check roles script._validateProxy = lambda i=None: None # Force proxy role if role != u'none': script.manage_proxy((role, )) body = body.encode('utf-8') params = 'fields, easyform, request' script.ZPythonScript_edit(params, body) return script
def updateScript(self, body, role): # Regenerate Python script object # Sync set of script source code, proxy role and # creation of Python Script object. bodyField = self.schema["ScriptBody"] proxyField = self.schema["ProxyRole"] script = PythonScript(self.title_or_id()) script = script.__of__(self) # Force proxy role if role != "none": script.manage_proxy((role,)) script.ZPythonScript_edit("fields, ploneformgen, request", body) PythonField.set(bodyField, self, script) StringField.set(proxyField, self, role)
def updateScript(self, body, role): # Regenerate Python script object # Sync set of script source code, proxy role and # creation of Python Script object. bodyField = self.schema["ScriptBody"] proxyField = self.schema["ProxyRole"] script = PythonScript(self.title_or_id()) script = script.__of__(self) # Force proxy role if role != "none": script.manage_proxy((role, )) script.ZPythonScript_edit("fields, ploneformgen, request", body) PythonField.set(bodyField, self, script) StringField.set(proxyField, self, role)
def getScript(self, context): # Generate Python script object body = self.ScriptBody role = self.ProxyRole script = PythonScript(self.__name__) script = script.__of__(context) # Skip check roles script._validateProxy = lambda i=None: None # Force proxy role if role != u"none": script.manage_proxy((role, )) if six.PY2 and isinstance(body, six.text_type): body = body.encode("utf-8") params = "fields, easyform, request" script.ZPythonScript_edit(params, body) return script