/
config.py
781 lines (693 loc) · 31.3 KB
/
config.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
# -*- coding: utf-8 -*-
try:
# Python 2.7
from collections import OrderedDict
except:
# Python 2.6
from gluon.contrib.simplejson.ordered_dict import OrderedDict
from gluon import current
from gluon.html import A, URL, TR, TD
from gluon.storage import Storage
from s3 import s3_fullname, S3Represent, S3SQLInlineLink, S3SQLSubFormLayout
def config(settings):
""" RefugeesWelcome Template """
T = current.T
settings.base.system_name = "#RefugeesWelcome"
settings.base.system_name_short = "#RefugeesWelcome"
# PrePopulate data
settings.base.prepopulate += ("RW", "default/users")
# Theme (folder to use for views/layout.html)
#settings.base.theme = "RW"
# Authentication settings
# Should users be allowed to register themselves?
#settings.security.self_registration = False
# Do new users need to verify their email address?
settings.auth.registration_requires_verification = True
# Do new users need to be approved by an administrator prior to being able to login?
#settings.auth.registration_requires_approval = True
settings.auth.registration_requests_organisation = True
settings.auth.registration_link_user_to_default = "staff"
# Approval emails get sent to all admins
settings.mail.approver = "ADMIN"
# Restrict the Location Selector to just certain countries
# NB This can also be over-ridden for specific contexts later
# e.g. Activities filtered to those of parent Project
#settings.gis.countries = ("DE",)
# Uncomment to display the Map Legend as a floating DIV
settings.gis.legend = "float"
# Uncomment to Disable the Postcode selector in the LocationSelector
#settings.gis.postcode_selector = False # @ToDo: Vary by country (include in the gis_config!)
# Uncomment to show the Print control:
# http://eden.sahanafoundation.org/wiki/UserGuidelines/Admin/MapPrinting
#settings.gis.print_button = True
# L10n settings
# Languages used in the deployment (used for Language Toolbar & GIS Locations)
# http://www.loc.gov/standards/iso639-2/php/code_list.php
settings.L10n.languages = OrderedDict([
("ar", "العربية"),
("en", "English"),
("fr", "Français"),
("de", "Deutsch"),
("el", "ελληνικά"),
("es", "Español"),
("it", "Italiano"),
("pt", "Português"),
("ru", "русский"),
("tr", "Türkçe"),
])
# Default language for Language Toolbar (& GIS Locations in future)
#settings.L10n.default_language = "de"
# Uncomment to Hide the language toolbar
#settings.L10n.display_toolbar = False
# Default timezone for users
#settings.L10n.utc_offset = "+0100"
# Number formats (defaults to ISO 31-0)
# Decimal separator for numbers (defaults to ,)
settings.L10n.decimal_separator = "."
# Thousands separator for numbers (defaults to space)
settings.L10n.thousands_separator = ","
# Uncomment this to Translate Layer Names
#settings.L10n.translate_gis_layer = True
# Uncomment this to Translate Location Names
settings.L10n.translate_gis_location = True
# Uncomment this to Translate Organisation Names/Acronyms
settings.L10n.translate_org_organisation = True
# Uncomment this to Translate Site Names
settings.L10n.translate_org_site = True
# Finance settings
#settings.fin.currencies = {
# "EUR" : "Euros",
# "GBP" : "Great British Pounds",
# "USD" : "United States Dollars",
#}
settings.fin.currency_default = "EUR"
# Security Policy
# http://eden.sahanafoundation.org/wiki/S3AAA#System-widePolicy
# 1: Simple (default): Global as Reader, Authenticated as Editor
# 2: Editor role required for Update/Delete, unless record owned by session
# 3: Apply Controller ACLs
# 4: Apply both Controller & Function ACLs
# 5: Apply Controller, Function & Table ACLs
# 6: Apply Controller, Function, Table ACLs and Entity Realm
# 7: Apply Controller, Function, Table ACLs and Entity Realm + Hierarchy
# 8: Apply Controller, Function, Table ACLs, Entity Realm + Hierarchy and Delegations
#
settings.security.policy = 7 # Organisation-ACLs
# -------------------------------------------------------------------------
# Custom icon classes
settings.ui.custom_icons = {
"news": "icon-info",
"needs": "icon-list",
"organisations": "icon-group",
}
# -------------------------------------------------------------------------
# CMS
# Uncomment to use Bookmarks in Newsfeed
settings.cms.bookmarks = True
# Uncomment to use have Filter form in Newsfeed be open by default
settings.cms.filter_open = True
# Uncomment to adjust filters in Newsfeed when clicking on locations instead of opening the profile page
settings.cms.location_click_filters = True
# Uncomment to use organisation_id instead of created_by in Newsfeed
settings.cms.organisation = "post_organisation.organisation_id"
# Uncomment to use org_group_id in Newsfeed
#settings.cms.organisation_group = "post_organisation_group.group_id"
# Uncomment to use person_id instead of created_by in Newsfeed
settings.cms.person = "person_id"
# Uncomment to use Rich Text editor in Newsfeed
settings.cms.richtext = True
# Uncomment to show Links in Newsfeed
settings.cms.show_links = True
# Uncomment to show Tags in Newsfeed
settings.cms.show_tags = True
# Uncomment to show post Titles in Newsfeed
settings.cms.show_titles = True
# -------------------------------------------------------------------------
# Organisations
settings.org.tags = True
settings.org.service_locations = True
# -------------------------------------------------------------------------
# Project Module
settings.project.projects = True
settings.project.mode_3w = True
settings.project.activities = True
settings.project.activity_types = True
settings.project.sectors = True
settings.project.multiple_organisations = True
settings.project.assign_staff_tab = False
# -------------------------------------------------------------------------
# Requests Module
#
settings.req.recurring = False
settings.req.use_req_number = False
settings.req.requester_optional = True
settings.req.summary = True
settings.req.use_commit = False
settings.req.ask_transport = True
settings.req.req_type = ("Stock",)
# -------------------------------------------------------------------------
# Shelters
settings.cr.tags = True
# -------------------------------------------------------------------------
def customise_cms_post_controller(**attr):
s3 = current.response.s3
# Custom prep
standard_prep = s3.prep
def custom_prep(r):
# Call standard prep
if callable(standard_prep):
result = standard_prep(r)
else:
result = True
table = r.table
# Simple Location Represent
#table.location_id.represent = S3Represent(lookup="gis_location")
# We only use a single type so hard-code it
table.series_id.readable = table.series_id.writable = False
if not r.record:
stable = current.s3db.cms_series
row = current.db(stable.name == "News").select(stable.id,
limitby=(0, 1)
).first()
try:
table.series_id.default = row.id
except:
# Prepop not done
# Undo the readable/writable so as not to mask the error
table.series_id.readable = table.series_id.writable = True
return result
s3.prep = custom_prep
return attr
settings.customise_cms_post_controller = customise_cms_post_controller
# -------------------------------------------------------------------------
def customise_project_location_resource(r, tablename):
s3db = current.s3db
table = s3db.project_location
# Allow editing of names
field = table.name
field.readable = field.writable = True
# Hide percentage field (not needed)
field = table.percentage
field.readable = field.writable = False
# Use location selector
from s3 import S3LocationSelector
field = table.location_id
field.widget = S3LocationSelector(show_address=True)
# List fields
list_fields = ["project_id",
"name",
"location_id",
"location_id$addr_street",
"activity_type_location.activity_type_id",
]
# CRUD Form
from s3 import S3SQLCustomForm, S3SQLInlineLink
crud_form = S3SQLCustomForm("project_id",
"name",
"location_id",
S3SQLInlineLink("activity_type",
field = "activity_type_id",
multiple = True,
),
"comments",
)
# Reconfigure resource
s3db.configure("project_location",
crud_form = crud_form,
list_fields = list_fields,
create_next = None,
onaccept = None,
)
settings.customise_project_location_resource = customise_project_location_resource
# -------------------------------------------------------------------------
def customise_org_facility_resource(r, tablename):
from s3 import S3LocationFilter, S3OptionsFilter, S3TextFilter
filter_widgets = [
S3TextFilter(["name"],
label = T("Search"),
comment = T("Search by facility name. You can use * as wildcard."),
),
S3OptionsFilter("site_facility_type.facility_type_id",
),
S3OptionsFilter("organisation_id",
),
S3LocationFilter("location_id",
),
]
s3db = current.s3db
s3db.configure(tablename,
filter_widgets = filter_widgets,
)
# Customize fields
table = s3db.org_facility
# Main facility flag visible and in custom crud form
field = table.main_facility
field.readable = field.writable = True
crud_form = s3db.get_config(tablename, "crud_form")
crud_form.insert(-2, "main_facility")
# "Obsolete" labeled as "inactive"
field = table.obsolete
field.label = T("inactive")
settings.customise_org_facility_resource = customise_org_facility_resource
# -------------------------------------------------------------------------
def customise_org_organisation_resource(r, tablename):
from gluon.html import DIV, INPUT
from s3 import s3_comments_widget, \
S3LocationSelector, \
S3MultiSelectWidget, \
S3SQLCustomForm, \
S3SQLInlineLink, \
S3SQLInlineComponent, \
S3SQLInlineComponentMultiSelectWidget
s3db = current.s3db
# Filtered component to access phone number and email
s3db.add_components("org_organisation",
org_facility = {"name": "main_facility",
"joinby": "organisation_id",
"filterby": "main_facility",
"filterfor": True,
},
)
s3db.org_organisation_location.location_id.widget = S3LocationSelector(levels=("L2", "L3", "L4"),
show_map=False,
labels=False,
)
crud_fields = ["name",
"acronym",
S3SQLInlineLink("organisation_type",
field = "organisation_type_id",
label = T("Type"),
multiple = False,
),
S3SQLInlineLink(
"service",
label = T("Services"),
field = "service_id",
),
S3SQLInlineComponent(
"facility",
label = T("Main Facility"),
fields = ["name",
"phone1",
"phone2",
"email",
"location_id",
],
layout = FacilitySubFormLayout,
filterby = {"field": "main_facility",
"options": True,
},
multiple = False,
),
"website",
S3SQLInlineComponent(
"contact",
name = "twitter",
label = T("Twitter"),
multiple = False,
fields = [("", "value")],
filterby = dict(field = "contact_method",
options = "TWITTER",
),
),
S3SQLInlineComponent(
"contact",
name = "facebook",
label = T("Facebook"),
multiple = False,
fields = [("", "value")],
filterby = dict(field = "contact_method",
options = "FACEBOOK",
),
),
"comments",
]
crud_form = S3SQLCustomForm(*crud_fields)
from s3 import S3LocationFilter, S3OptionsFilter, S3TextFilter#, S3HierarchyFilter
filter_widgets = [
S3TextFilter(["name", "acronym"],
label = T("Search"),
comment = T("Search by organization name or acronym. You can use * as wildcard."),
_class = "filter-search",
),
S3LocationFilter("org_facility.location_id",
label = T("Location"),
#hidden = True,
),
S3OptionsFilter("organisation_organisation_type.organisation_type_id",
label = T("Type"),
#hidden = True,
),
S3OptionsFilter("service_organisation.service_id",
#hidden = True,
),
]
list_fields = ["name",
(T("Type"), "organisation_organisation_type.organisation_type_id"),
(T("Services"), "service.name"),
(T("Adresse"), "main_facility.location_id"),
(T("Phone #"), "main_facility.phone1"),
(T("Email"), "main_facility.email"),
(T("Facebook"), "main_facility.facebook"),
"website",
]
s3db.configure("org_organisation",
crud_form = crud_form,
filter_widgets = filter_widgets,
list_fields = list_fields,
)
settings.customise_org_organisation_resource = customise_org_organisation_resource
# -------------------------------------------------------------------------
def customise_org_organisation_controller(**attr):
tabs = [(T("Basic Details"), None),
(T("Service Locations"), "service_location"),
(T("Needs"), "needs"),
(T("Facilities"), "facility"),
(T("Warehouses"), "warehouse"),
(T("Offices"), "office"),
(T("Staff & Volunteers"), "human_resource"),
#(T("Assets"), "asset"),
#(T("Projects"), "project"),
#(T("User Roles"), "roles"),
#(T("Tasks"), "task"),
]
rheader = lambda r: current.s3db.org_rheader(r, tabs=tabs)
attr["rheader"] = rheader
return attr
settings.customise_org_organisation_controller = customise_org_organisation_controller
# -------------------------------------------------------------------------
def customise_req_organisation_needs_resource(r, tablename):
if tablename == "req_organisation_needs":
organisation_id = "organisation_id"
else:
organisation_id = None
from s3 import S3SQLCustomForm, S3SQLInlineComponent
crud_form = S3SQLCustomForm(
organisation_id,
S3SQLInlineComponent("organisation_needs_skill",
label = T("Volunteers needed"),
fields = ["skill_id",
"demand",
"comments",
],
),
S3SQLInlineComponent("organisation_needs_item",
label = T("Supplies needed"),
fields = ["item_id",
"demand",
"comments",
],
),
(T("Cash Donations needed"), "money"),
"money_details",
"vol",
"vol_details",
)
current.s3db.configure("req_organisation_needs",
crud_form = crud_form,
)
settings.customise_req_organisation_needs_resource = customise_req_organisation_needs_resource
# -------------------------------------------------------------------------
def customise_req_site_needs_resource(r, tablename):
if r.tablename == "req_site_needs":
table = r.table
field = table.site_id
field.label = current.T("Facility")
field.readable = field.writable = True
# Allow only facilities which do not have a req_site_needs
# yet (single component), and filter out obsolete facilities
from s3 import IS_ONE_OF, FS
dbset = current.db(table.id == None)
left = table.on(table.site_id == current.s3db.org_site.id)
field.requires = IS_ONE_OF(dbset, "org_site.site_id",
field.represent,
left = left,
not_filterby = "obsolete",
not_filter_opts = (True,),
orderby = "org_site.name",
sort = True,
)
if not r.record:
query = FS("site_id$obsolete") != True
r.resource.add_filter(query)
# Allow adding of facilities in popup
from s3layouts import S3PopupLink
field.comment = S3PopupLink(c = "org",
f = "facility",
vars = {"child": "site_id",
"parent": "site_needs",
},
title = T("Add New Facility"),
)
# Filters
from s3 import S3LocationFilter, S3TextFilter
filter_widgets = [S3TextFilter(["site_id$name",
"vol_details",
"goods_details",
],
label = T("Search"),
),
S3LocationFilter("site_id$location_id",
),
]
# List fields
list_fields = [(T("Facility"), "site_id$name"),
"site_id$location_id",
("%s?" % T("Volunteers"), "vol"),
(T("Help Wanted"), "vol_details"),
("%s?" % T("Donations"), "goods"),
(T("Donations Needed"), "goods_details"),
"modified_on",
]
current.s3db.configure("req_site_needs",
filter_widgets = filter_widgets,
list_fields = list_fields,
)
settings.customise_req_site_needs_resource = customise_req_site_needs_resource
# -------------------------------------------------------------------------
# Comment/uncomment modules here to disable/enable them
# Modules menu is defined in modules/eden/menu.py
settings.modules = OrderedDict([
# Core modules which shouldn't be disabled
("default", Storage(
name_nice = T("Home"),
restricted = False, # Use ACLs to control access to this module
access = None, # All Users (inc Anonymous) can see this module in the default menu & access the controller
module_type = None # This item is not shown in the menu
)),
("admin", Storage(
name_nice = T("Administration"),
#description = "Site Administration",
restricted = True,
access = "|1|", # Only Administrators can see this module in the default menu & access the controller
module_type = None # This item is handled separately for the menu
)),
("appadmin", Storage(
name_nice = T("Administration"),
#description = "Site Administration",
restricted = True,
module_type = None # No Menu
)),
("errors", Storage(
name_nice = T("Ticket Viewer"),
#description = "Needed for Breadcrumbs",
restricted = False,
module_type = None # No Menu
)),
#("sync", Storage(
# name_nice = T("Synchronization"),
# #description = "Synchronization",
# restricted = True,
# access = "|1|", # Only Administrators can see this module in the default menu & access the controller
# module_type = None # This item is handled separately for the menu
#)),
#("tour", Storage(
# name_nice = T("Guided Tour Functionality"),
# module_type = None,
#)),
#("translate", Storage(
# name_nice = T("Translation Functionality"),
# #description = "Selective translation of strings based on module.",
# module_type = None,
#)),
("gis", Storage(
name_nice = T("Map"),
#description = "Situation Awareness & Geospatial Analysis",
restricted = True,
module_type = 6, # 6th item in the menu
)),
("pr", Storage(
name_nice = T("Person Registry"),
#description = "Central point to record details on People",
restricted = True,
access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still)
module_type = 10
)),
("org", Storage(
name_nice = T("Organizations"),
#description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities',
restricted = True,
module_type = 1
)),
("hrm", Storage(
name_nice = T("Staff"),
#description = "Human Resources Management",
restricted = True,
module_type = 10,
)),
("vol", Storage(
name_nice = T("Volunteers"),
#description = "Human Resources Management",
restricted = True,
module_type = 10,
)),
("cms", Storage(
name_nice = T("Content Management"),
#description = "Content Management System",
restricted = True,
module_type = 10,
)),
("doc", Storage(
name_nice = T("Documents"),
#description = "A library of digital resources, such as photos, documents and reports",
restricted = True,
module_type = 10,
)),
#("msg", Storage(
# name_nice = T("Messaging"),
# #description = "Sends & Receives Alerts via Email & SMS",
# restricted = True,
# # The user-visible functionality of this module isn't normally required. Rather it's main purpose is to be accessed from other modules.
# module_type = None,
#)),
("supply", Storage(
name_nice = T("Supply Chain Management"),
#description = "Used within Inventory Management, Request Management and Asset Management",
restricted = True,
module_type = None, # Not displayed
)),
("inv", Storage(
name_nice = T("Warehouses"),
#description = "Receiving and Sending Items",
restricted = True,
module_type = 4
)),
#("asset", Storage(
# name_nice = T("Assets"),
# #description = "Recording and Assigning Assets",
# restricted = True,
# module_type = 5,
#)),
# Vehicle depends on Assets
#("vehicle", Storage(
# name_nice = T("Vehicles"),
# #description = "Manage Vehicles",
# restricted = True,
# module_type = 10,
#)),
("req", Storage(
name_nice = T("Requests"),
#description = "Manage requests for supplies, assets, staff or other resources. Matches against Inventories where supplies are requested.",
restricted = True,
module_type = 10,
)),
("project", Storage(
name_nice = T("Projects"),
#description = "Tracking of Projects, Activities and Tasks",
restricted = True,
module_type = 2
)),
("cr", Storage(
name_nice = T("Shelters"),
#description = "Tracks the location, capacity and breakdown of victims in Shelters",
restricted = True,
module_type = 10
)),
#("hms", Storage(
# name_nice = T("Hospitals"),
# #description = "Helps to monitor status of hospitals",
# restricted = True,
# module_type = 10
#)),
#("dvr", Storage(
# name_nice = T("Disaster Victim Registry"),
# #description = "Allow affected individuals & households to register to receive compensation and distributions",
# restricted = True,
# module_type = 10,
#)),
("mpr", Storage(
name_nice = T("Missing Persons"),
#description = "Helps to report and search for missing persons",
restricted = True,
module_type = 10,
)),
("event", Storage(
name_nice = T("Events"),
#description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).",
restricted = True,
module_type = 10,
)),
("transport", Storage(
name_nice = T("Transport"),
restricted = True,
module_type = 10,
)),
("stats", Storage(
name_nice = T("Statistics"),
#description = "Manages statistics",
restricted = True,
module_type = None,
)),
])
# =============================================================================
class FacilitySubFormLayout(S3SQLSubFormLayout):
"""
Custom layout for facility inline-component in org/organisation
- allows embedding of multiple fields besides the location selector
- renders an vertical layout for edit-rows
- standard horizontal layout for read-rows
- hiding header row if there are no visible read-rows
"""
# -------------------------------------------------------------------------
def headers(self, data, readonly=False):
"""
Header-row layout: same as default, but non-static (i.e. hiding
if there are no visible read-rows, because edit-rows have their
own labels)
"""
headers = super(FacilitySubFormLayout, self).headers
header_row = headers(data, readonly = readonly)
element = header_row.element('tr');
if hasattr(element, "remove_class"):
element.remove_class("static")
return header_row
# -------------------------------------------------------------------------
def rowstyle_read(self, form, fields, *args, **kwargs):
"""
Formstyle for subform read-rows, same as standard
horizontal layout.
"""
rowstyle = super(FacilitySubFormLayout, self).rowstyle
return rowstyle(form, fields, *args, **kwargs)
# -------------------------------------------------------------------------
def rowstyle(self, form, fields, *args, **kwargs):
"""
Formstyle for subform edit-rows, using a vertical
formstyle because multiple fields combined with
location-selector are too complex for horizontal
layout.
"""
# Use standard foundation formstyle
from s3theme import formstyle_foundation as formstyle
if args:
col_id = form
label = fields
widget, comment = args
hidden = kwargs.get("hidden", False)
return formstyle(col_id, label, widget, comment, hidden)
else:
parent = TD(_colspan = len(fields))
for col_id, label, widget, comment in fields:
parent.append(formstyle(col_id, label, widget, comment))
return TR(parent)
# END =========================================================================