7 |
|
|
8 |
schema = BaseSchema + Schema(( |
schema = BaseSchema + Schema(( |
9 |
|
|
10 |
|
LinesField('country', |
11 |
|
widget=MultiSelectionWidget(label='Participating Countries', |
12 |
|
description="If the Uninted States is one of the countries, select the states that will be involved in this action"), |
13 |
|
vocabulary='getCountries', |
14 |
|
storage=PostgreSQLStorage(), |
15 |
|
), |
16 |
|
|
17 |
|
LinesField('us_state', |
18 |
|
widget=MultiSelectionWidget(label='Participating US States', |
19 |
|
description="If the Uninted States is one of the countries, select the states that will be involved in this action"), |
20 |
|
vocabulary='getUSStates', |
21 |
|
storage=PostgreSQLStorage(), |
22 |
|
), |
23 |
|
LinesField('political_party', |
24 |
|
widget=MultiSelectionWidget(label='Political party', |
25 |
|
description="To restrict this action to a perticular political party, select it here."), |
26 |
|
vocabulary='getPoliticalParties', |
27 |
|
storage=PostgreSQLStorage(), |
28 |
|
), |
29 |
# CurrentOffice for politicians |
# CurrentOffice for politicians |
30 |
StringField('current_position', |
StringField('current_position', |
31 |
widget=StringWidget(label='Current Position'), |
widget=StringWidget(label='Current Position'), |
54 |
widget=StringWidget(label='Next Election'), |
widget=StringWidget(label='Next Election'), |
55 |
storage=PostgreSQLStorage(), |
storage=PostgreSQLStorage(), |
56 |
), |
), |
|
StringField('party', |
|
|
widget=StringWidget(label='Party'), |
|
|
storage=PostgreSQLStorage(), |
|
|
), |
|
57 |
# mmm, True == Male (of course, since I'm a guy) |
# mmm, True == Male (of course, since I'm a guy) |
58 |
BooleanField('gender', |
BooleanField('gender', |
59 |
widget=BooleanWidget(label='Gender'), |
widget=BooleanWidget(label='Gender'), |
96 |
archetype_name = "Action Recipient List" |
archetype_name = "Action Recipient List" |
97 |
actions = TemplateMixin.actions |
actions = TemplateMixin.actions |
98 |
|
|
99 |
|
def getUSStates(self): |
100 |
|
result = DisplayList() |
101 |
|
try: |
102 |
|
props = self.portal_properties.geographic_properties.getProperty('us_states') |
103 |
|
except: |
104 |
|
return DisplayList(()) |
105 |
|
|
106 |
|
mylist = [] |
107 |
|
|
108 |
|
for item in props: |
109 |
|
mylist.append(item.split('|')) |
110 |
|
|
111 |
|
for item in mylist: |
112 |
|
result.add(item[0], item[1]) |
113 |
|
|
114 |
|
return result |
115 |
|
|
116 |
|
def getCountries(self): |
117 |
|
result = DisplayList() |
118 |
|
try: |
119 |
|
props = self.portal_properties.geographic_properties.getProperty('countries') |
120 |
|
except: |
121 |
|
return DisplayList(()) |
122 |
|
|
123 |
|
mylist = [] |
124 |
|
|
125 |
|
for item in props: |
126 |
|
mylist.append(item.split('|')) |
127 |
|
|
128 |
|
for item in mylist: |
129 |
|
result.add(item[0], item[1]) |
130 |
|
|
131 |
|
return result |
132 |
|
|
133 |
|
def getPoliticalParties(self): |
134 |
|
result = DisplayList() |
135 |
|
try: |
136 |
|
props = self.portal_properties.pac_properties.getProperty('political_parties') |
137 |
|
except: |
138 |
|
return DisplayList(()) |
139 |
|
|
140 |
|
mylist = [] |
141 |
|
|
142 |
|
for item in props: |
143 |
|
mylist.append(item.split('|')) |
144 |
|
|
145 |
|
for item in mylist: |
146 |
|
result.add(item[0], item[1]) |
147 |
|
|
148 |
|
return result |
149 |
|
|
150 |
registerType(ActionRecipientList) |
registerType(ActionRecipientList) |