-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.py
27 lines (21 loc) · 1.1 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from core import plugin, model
import jimi
class _script(plugin._plugin):
version = 4.0
def install(self):
# Register models
model.registerModel("scriptBlock","_scriptBlock","_action","plugins.script.models.action")
return True
def uninstall(self):
# deregister models
model.deregisterModel("scriptBlock","_scriptBlock","_action","plugins.script.models.action")
return True
def upgrade(self,LatestPluginVersion):
if self.version < 4.0:
from plugins.script.models import action
classes = jimi.db.getClassByName("_scriptBlock",None)
if len(classes) == 1:
scriptBlocks = action._scriptBlock().getAsClass(query={ "classID" : classes[0]["_id"] })
for scriptBlock in scriptBlocks:
scriptBlock.scriptBlock = scriptBlock.scriptBlock.replace("def run(data):\r\n","def run(data):\r\n\tdata = data[\"flowData\"]\r\n").replace("def run(data):\n","def run(data):\n\tdata = data[\"flowData\"]\n")
scriptBlock.update(["scriptBlock"])