def mailing_list():
 tablename = 'pr_group'
 table = s3db[tablename]
 s3.filter = (table.group_type == 5)
 table.group_type.writable = False
 table.group_type.readable = False
 table.name.label = T('Mailing List Name')
 s3.crud_strings[tablename] = s3.pr_mailing_list_crud_strings
 list_fields = s3db.configure(tablename, list_fields=['id', 'name', 'description'])
 _rheader = s3db.pr_rheader
 _tabs = [(T('Organization'), 'organisation/'), (T('Mailing List Details'), None)]
 if (len(request.args) > 0):
  _tabs.append((T('Members'), 'group_membership'))
 if ('viewing' in request.vars):
  (tablename, record_id) = request.vars.viewing.rsplit('.', 1)
  if (tablename == 'org_organisation'):
   table = s3db[tablename]
   _rheader = s3db.org_rheader
   _tabs = []
 s3db.add_components('pr_group', pr_group_membership='group_id')
 rheader = (lambda r: _rheader(r, tabs=_tabs))
 return s3_rest_controller('pr', 'group', rheader=rheader)

def mailing_list ( ) : tablename = 'pr_group' table = s3db [ tablename ] s3 . filter = ( table . group_type == 5 ) table . group_type . writable = False table . group_type . readable = False table . name . label = T ( 'Mailing List Name' ) s3 . crud_strings [ tablename ] = s3 . pr_mailing_list_crud_strings list_fields = s3db . configure ( tablename , list_fields = [ 'id' , 'name' , 'description' ] ) _rheader = s3db . pr_rheader _tabs = [ ( T ( 'Organization' ) , 'organisation/' ) , ( T ( 'Mailing List Details' ) , None ) ] if ( len ( request . args ) > 0 ) : _tabs . append ( ( T ( 'Members' ) , 'group_membership' ) ) if ( 'viewing' in request . vars ) : ( tablename , record_id ) = request . vars . viewing . rsplit ( '.' , 1 ) if ( tablename == 'org_organisation' ) : table = s3db [ tablename ] _rheader = s3db . org_rheader _tabs = [ ] s3db . add_components ( 'pr_group' , pr_group_membership = 'group_id' ) rheader = ( lambda r : _rheader ( r , tabs = _tabs ) ) return s3_rest_controller ( 'pr' , 'group' , rheader = rheader )
restful crud controller .