def updateScript(self, body): # Regenerate Python script object # Sync set of script source code and # creation of Python Script object. bodyField = self.schema["mipago_payment_amountOverride"] script = PythonScript(self.title_or_id()) script = script.__of__(self) script.ZPythonScript_edit("fields, ploneformgen, request", body) PythonField.set(bodyField, self, 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 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
def getDefault(self, instance): value = ObjectField.getDefault(self, instance) script = PythonScript(self.getName()) script.ZPythonScript_edit('**options', value) return script.__of__(instance)
def restricted_exec(self, body, varmap=None): ps = PythonScript("temp") if varmap is None: varmap = {} ps.ZPythonScript_edit(join(varmap.keys(), ","), body) return ps.__of__(self)(varmap.values())
def restricted_exec(self, body, varmap=None): ps = PythonScript('temp') if varmap is None: varmap = {} ps.ZPythonScript_edit(join(varmap.keys(), ','), body) return ps.__of__(self)(varmap.values())
def restricted_exec(self, body, varmap=None): ps = PythonScript('temp') if varmap is None: varmap = {} ps.ZPythonScript_edit(join(varmap.keys(), ','), body) return apply(ps.__of__(self), varmap.values())