-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathactionradio.py
More file actions
46 lines (35 loc) · 1.33 KB
/
actionradio.py
File metadata and controls
46 lines (35 loc) · 1.33 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
#This software is released under GNU public license. See details in the URL:
#http://www.gnu.org/copyleft/gpl.html
from commonradio import CommonRadio
#For Security control and init
from AccessControl import ClassSecurityInfo
import Globals
class ActionRadio(CommonRadio):
"ActionRadio class"
security = ClassSecurityInfo()
meta_type = "ActionRadio"
data = 0
name = "Radio Button"
classConfig = {}
classConfig['name'] = {'name':'name', 'type':'string'}
updateReplaceList = ('name',)
configurable = ('name',)
security.declareProtected('View management screens', 'edit')
def edit(self, *args, **kw):
"Inline edit short object"
return '<p>%s:%s</p>' % (self.getConfig('name'), self.true_false('data', self.data, 0))
security.declarePrivate('populatorInformation')
def populatorInformation(self):
"return a string that this metods pair can read back to load data in this object"
return self.data
security.declarePrivate('populatorLoader')
def populatorLoader(self, string):
"load the data into this object if it matches me"
try:
self.setObject('data', bool(int(string)))
except ValueError:
pass
Globals.InitializeClass(ActionRadio)
import register
register.registerClass(ActionRadio)