<s> """<STR_LIT>""" <EOL> __all__ = ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ) <EOL> from gluon import * <EOL> from gluon . storage import Storage <EOL> from . . s3 import * <EOL> from . . s3layouts import S3PopupLink <EOL> class S3TransportModel ( S3Model ) : <EOL> """<STR_LIT>""" <EOL> names = ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ) <EOL> def model ( self ) : <EOL> T = current . T <EOL> db = current . db <EOL> messages = current . messages <EOL> UNKNOWN_OPT = messages . UNKNOWN_OPT <EOL> settings = current . deployment_settings <EOL> configure = self . configure <EOL> crud_strings = current . response . s3 . crud_strings <EOL> define_table = self . define_table <EOL> super_link = self . super_link <EOL> location_id = self . gis_location_id <EOL> organisation_id = self . org_organisation_id <EOL> obsolete_options = { True : T ( "<STR_LIT>" ) , <EOL> False : T ( "<STR_LIT>" ) , <EOL> } <EOL> storage_types = { <EOL> <NUM_LIT:1> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:2> : T ( "<STR_LIT>" ) , <EOL> } <EOL> airport_capacity_opts = { <EOL> <NUM_LIT:2> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:3> : T ( "<STR_LIT>" ) <EOL> } <EOL> runway_surface_opts = { "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> } <EOL> aircraft_size_opts = { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : T ( "<STR_LIT>" ) , <EOL> } <EOL> humanitarian_use_opts = { <NUM_LIT:1> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:2> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:3> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:4> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:9> : T ( "<STR_LIT>" ) , <EOL> } <EOL> if settings . get_transport_airport_code_unique ( ) : <EOL> code_requires = IS_EMPTY_OR ( [ IS_LENGTH ( <NUM_LIT:10> ) , <EOL> IS_NOT_IN_DB ( db , "<STR_LIT>" ) , <EOL> ] ) <EOL> else : <EOL> code_requires = IS_EMPTY_OR ( IS_LENGTH ( <NUM_LIT:10> ) ) <EOL> tablename = "<STR_LIT>" <EOL> define_table ( tablename , <EOL> super_link ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> Field ( "<STR_LIT:name>" , notnull = True , <EOL> length = <NUM_LIT:64> , <EOL> label = T ( "<STR_LIT:Name>" ) , <EOL> requires = IS_NOT_EMPTY ( ) , <EOL> ) , <EOL> Field ( "<STR_LIT:code>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> length = <NUM_LIT:10> , <EOL> requires = code_requires , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , length = <NUM_LIT:4> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> requires = IS_EMPTY_OR ( IS_NOT_IN_DB ( db , "<STR_LIT>" ) ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , length = <NUM_LIT:3> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> requires = IS_EMPTY_OR ( IS_NOT_IN_DB ( db , "<STR_LIT>" ) ) , <EOL> ) , <EOL> location_id ( ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : runway_surface_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( runway_surface_opts ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : aircraft_size_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_EMPTY_OR ( <EOL> IS_IN_SET ( aircraft_size_opts ) <EOL> ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : humanitarian_use_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_EMPTY_OR ( <EOL> IS_IN_SET ( humanitarian_use_opts ) <EOL> ) , <EOL> ) , <EOL> organisation_id ( ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda bool : ( bool and [ T ( "<STR_LIT>" ) ] or [ T ( "<STR_LIT>" ) ] ) [ <NUM_LIT:0> ] , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda bool : ( bool and [ T ( "<STR_LIT>" ) ] or [ T ( "<STR_LIT>" ) ] ) [ <NUM_LIT:0> ] , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> comment = DIV ( _class = "<STR_LIT>" , <EOL> _title = "<STR_LIT>" % ( T ( "<STR_LIT>" ) , <EOL> T ( "<STR_LIT>" ) ) ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : storage_types . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_EMPTY_OR ( <EOL> IS_IN_SET ( storage_types ) <EOL> ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : airport_capacity_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_EMPTY_OR ( <EOL> IS_IN_SET ( airport_capacity_opts ) <EOL> ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> self . pr_person_id ( <EOL> label = T ( "<STR_LIT>" ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = False , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = S3Represent ( options = obsolete_options ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> s3_comments ( ) , <EOL> * s3_meta_fields ( ) ) <EOL> crud_strings [ tablename ] = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> title_upload = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> label_delete_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) ) <EOL> configure ( tablename , <EOL> list_fields = [ "<STR_LIT:name>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> super_entity = "<STR_LIT>" , <EOL> ) <EOL> if settings . get_transport_heliport_code_unique ( ) : <EOL> code_requires = IS_EMPTY_OR ( [ IS_LENGTH ( <NUM_LIT:10> ) , <EOL> IS_NOT_IN_DB ( db , "<STR_LIT>" ) , <EOL> ] ) <EOL> else : <EOL> code_requires = IS_EMPTY_OR ( IS_LENGTH ( <NUM_LIT:10> ) ) <EOL> tablename = "<STR_LIT>" <EOL> define_table ( tablename , <EOL> super_link ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> Field ( "<STR_LIT:name>" , notnull = True , <EOL> length = <NUM_LIT:64> , <EOL> label = T ( "<STR_LIT:Name>" ) , <EOL> requires = IS_NOT_EMPTY ( ) , <EOL> ) , <EOL> Field ( "<STR_LIT:code>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> length = <NUM_LIT:10> , <EOL> requires = code_requires , <EOL> ) , <EOL> organisation_id ( ) , <EOL> location_id ( ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = False , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = S3Represent ( options = obsolete_options ) , <EOL> readable = False , <EOL> writable = False , <EOL> ) , <EOL> s3_comments ( ) , <EOL> * s3_meta_fields ( ) ) <EOL> crud_strings [ tablename ] = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> title_upload = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> label_delete_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) ) <EOL> configure ( tablename , <EOL> super_entity = "<STR_LIT>" , <EOL> ) <EOL> ownership_opts = { <EOL> <NUM_LIT:1> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:2> : T ( "<STR_LIT>" ) <EOL> } <EOL> unit_opts = { <EOL> <NUM_LIT:1> : T ( "<STR_LIT>" ) , <EOL> <NUM_LIT:2> : T ( "<STR_LIT:m>" ) <EOL> } <EOL> if settings . get_transport_seaport_code_unique ( ) : <EOL> code_requires = IS_EMPTY_OR ( [ IS_LENGTH ( <NUM_LIT:10> ) , <EOL> IS_NOT_IN_DB ( db , "<STR_LIT>" ) , <EOL> ] ) <EOL> else : <EOL> code_requires = IS_EMPTY_OR ( IS_LENGTH ( <NUM_LIT:10> ) ) <EOL> tablename = "<STR_LIT>" <EOL> define_table ( tablename , <EOL> super_link ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> Field ( "<STR_LIT:name>" , notnull = True , <EOL> length = <NUM_LIT:64> , <EOL> label = T ( "<STR_LIT:Name>" ) , <EOL> requires = IS_NOT_EMPTY ( ) , <EOL> ) , <EOL> Field ( "<STR_LIT:code>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> length = <NUM_LIT:10> , <EOL> requires = code_requires , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : ownership_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( ownership_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = False , <EOL> represent = lambda opt : ( opt and [ T ( "<STR_LIT>" ) ] or [ T ( "<STR_LIT>" ) ] ) [ <NUM_LIT:0> ] , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = False , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : ( opt and [ T ( "<STR_LIT>" ) ] or [ T ( "<STR_LIT>" ) ] ) [ <NUM_LIT:0> ] , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT:text>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = lambda opt : unit_opts . get ( opt , UNKNOWN_OPT ) , <EOL> requires = IS_IN_SET ( unit_opts , zero = None ) , <EOL> ) , <EOL> organisation_id ( ) , <EOL> location_id ( ) , <EOL> Field ( "<STR_LIT>" , "<STR_LIT>" , <EOL> default = False , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = S3Represent ( options = obsolete_options ) , <EOL> ) , <EOL> s3_comments ( ) , <EOL> * s3_meta_fields ( ) ) <EOL> crud_strings [ tablename ] = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> title_upload = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> label_delete_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) ) <EOL> configure ( tablename , <EOL> super_entity = "<STR_LIT>" , <EOL> ) <EOL> border_crossing_status = ( ( "<STR_LIT>" , T ( "<STR_LIT>" ) ) , <EOL> ( "<STR_LIT>" , T ( "<STR_LIT>" ) ) , <EOL> ( "<STR_LIT>" , T ( "<STR_LIT>" ) ) , <EOL> ) <EOL> tablename = "<STR_LIT>" <EOL> define_table ( tablename , <EOL> Field ( "<STR_LIT:name>" , notnull = True , <EOL> length = <NUM_LIT:64> , <EOL> label = T ( "<STR_LIT:Name>" ) , <EOL> requires = IS_NOT_EMPTY ( ) , <EOL> ) , <EOL> location_id ( <EOL> widget = S3LocationSelector ( levels = [ ] , <EOL> show_address = False , <EOL> show_postcode = False , <EOL> show_latlon = True , <EOL> show_map = True , <EOL> ) , <EOL> ) , <EOL> Field ( "<STR_LIT:status>" , <EOL> default = "<STR_LIT>" , <EOL> represent = S3Represent ( options = dict ( border_crossing_status ) ) , <EOL> requires = IS_IN_SET ( border_crossing_status , <EOL> zero = None , <EOL> sort = False , <EOL> ) , <EOL> ) , <EOL> s3_comments ( ) , <EOL> * s3_meta_fields ( ) ) <EOL> self . add_components ( tablename , <EOL> transport_border_crossing_country = "<STR_LIT>" , <EOL> transport_border_control_point = "<STR_LIT>" , <EOL> ) <EOL> crud_strings [ tablename ] = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> title_upload = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> label_delete_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) ) <EOL> crud_form = S3SQLCustomForm ( "<STR_LIT:name>" , <EOL> "<STR_LIT>" , <EOL> S3SQLInlineComponent ( "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> fields = [ ( "<STR_LIT>" , "<STR_LIT>" ) ] , <EOL> ) , <EOL> "<STR_LIT:status>" , <EOL> "<STR_LIT>" , <EOL> ) <EOL> list_fields = [ "<STR_LIT:name>" , <EOL> ( T ( "<STR_LIT>" ) , "<STR_LIT>" ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT:status>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> filter_widgets = [ S3TextFilter ( [ "<STR_LIT:name>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> S3OptionsFilter ( "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> ) <EOL> ] <EOL> configure ( tablename , <EOL> crud_form = crud_form , <EOL> deduplicate = S3Duplicate ( primary = ( "<STR_LIT:name>" , ) ) , <EOL> filter_widgets = filter_widgets , <EOL> list_fields = list_fields , <EOL> ) <EOL> represent = transport_BorderCrossingRepresent ( show_link = True ) <EOL> border_crossing_id = S3ReusableField ( "<STR_LIT>" , "<STR_LIT>" % tablename , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = represent , <EOL> requires = IS_ONE_OF ( db , "<STR_LIT>" % tablename , <EOL> represent , <EOL> ) , <EOL> sortby = "<STR_LIT:name>" , <EOL> comment = S3PopupLink ( c = "<STR_LIT>" , <EOL> f = "<STR_LIT>" , <EOL> tooltip = T ( "<STR_LIT>" ) , <EOL> ) , <EOL> ) <EOL> current_countries = lambda : current . gis . get_countries ( key_type = "<STR_LIT:code>" ) <EOL> tablename = "<STR_LIT>" <EOL> define_table ( tablename , <EOL> border_crossing_id ( ) , <EOL> Field ( "<STR_LIT>" , length = <NUM_LIT:2> , <EOL> label = T ( "<STR_LIT>" ) , <EOL> represent = self . gis_country_code_represent , <EOL> requires = IS_EMPTY_OR ( IS_IN_SET_LAZY ( <EOL> current_countries , <EOL> zero = messages . SELECT_LOCATION , <EOL> ) ) , <EOL> ) , <EOL> * s3_meta_fields ( ) ) <EOL> tablename = "<STR_LIT>" <EOL> define_table ( tablename , <EOL> super_link ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> super_link ( "<STR_LIT>" , "<STR_LIT>" ) , <EOL> Field ( "<STR_LIT:name>" , notnull = True , <EOL> length = <NUM_LIT:64> , <EOL> label = T ( "<STR_LIT:Name>" ) , <EOL> requires = IS_NOT_EMPTY ( ) , <EOL> ) , <EOL> border_crossing_id ( ) , <EOL> organisation_id ( ) , <EOL> location_id ( ) , <EOL> s3_comments ( ) , <EOL> * s3_meta_fields ( ) ) <EOL> crud_strings [ tablename ] = Storage ( <EOL> label_create = T ( "<STR_LIT>" ) , <EOL> title_display = T ( "<STR_LIT>" ) , <EOL> title_list = T ( "<STR_LIT>" ) , <EOL> title_update = T ( "<STR_LIT>" ) , <EOL> title_upload = T ( "<STR_LIT>" ) , <EOL> label_list_button = T ( "<STR_LIT>" ) , <EOL> label_delete_button = T ( "<STR_LIT>" ) , <EOL> msg_record_created = T ( "<STR_LIT>" ) , <EOL> msg_record_modified = T ( "<STR_LIT>" ) , <EOL> msg_record_deleted = T ( "<STR_LIT>" ) , <EOL> msg_list_empty = T ( "<STR_LIT>" ) , <EOL> ) <EOL> configure ( tablename , <EOL> super_entity = ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ) , <EOL> ) <EOL> return { } <EOL> @ staticmethod <EOL> def transport_airport_onaccept ( form ) : <EOL> """<STR_LIT>""" <EOL> return <EOL> @ staticmethod <EOL> def transport_heliport_onaccept ( form ) : <EOL> """<STR_LIT>""" <EOL> return <EOL> @ staticmethod <EOL> def transport_seaport_onaccept ( form ) : <EOL> """<STR_LIT>""" <EOL> return <EOL> class transport_BorderCrossingRepresent ( S3Represent ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , show_link = False ) : <EOL> """<STR_LIT>""" <EOL> super ( transport_BorderCrossingRepresent , self ) . __init__ ( <EOL> lookup = "<STR_LIT>" , <EOL> show_link = show_link , <EOL> ) <EOL> def represent_row ( self , row ) : <EOL> """<STR_LIT>""" <EOL> if hasattr ( row , "<STR_LIT>" ) : <EOL> row = row . transport_border_crossing <EOL> representation = row . name <EOL> if hasattr ( row , "<STR_LIT>" ) : <EOL> representation = "<STR_LIT>" % ( representation , <EOL> "<STR_LIT:U+002CU+0020>" . join ( row . countries ) , <EOL> ) <EOL> return representation <EOL> def lookup_rows ( self , key , values , fields = [ ] ) : <EOL> """<STR_LIT>""" <EOL> s3db = current . s3db <EOL> btable = self . table <EOL> ctable = s3db . transport_border_crossing_country <EOL> left = ctable . on ( ( ctable . border_crossing_id == btable . id ) & ( ctable . deleted != True ) ) <EOL> if len ( values ) == <NUM_LIT:1> : <EOL> query = ( key == values [ <NUM_LIT:0> ] ) <EOL> else : <EOL> query = key . belongs ( values ) <EOL> rows = current . db ( query ) . select ( btable . id , <EOL> btable . name , <EOL> ctable . country , <EOL> left = left ) <EOL> self . queries += <NUM_LIT:1> <EOL> output = { } <EOL> country_represent = s3db . gis_country_code_represent <EOL> for row in rows : <EOL> country = country_represent ( row [ ctable . country ] ) <EOL> crossing = row [ "<STR_LIT>" ] <EOL> crossing_id = crossing . id <EOL> output_row = output . get ( crossing_id ) <EOL> if output_row : <EOL> countries = output_row . countries <EOL> countries . append ( country ) <EOL> else : <EOL> crossing . countries = [ country ] <EOL> output [ crossing_id ] = crossing <EOL> return output . values ( ) <EOL> def transport_rheader ( r , tabs = [ ] ) : <EOL> """<STR_LIT>""" <EOL> if r . representation != "<STR_LIT:html>" : <EOL> return None <EOL> settings = current . deployment_settings <EOL> s3db = current . s3db <EOL> tablename , record = s3_rheader_resource ( r ) <EOL> table = s3db . table ( tablename ) <EOL> rheader = None <EOL> rheader_fields = [ ] <EOL> if record : <EOL> T = current . T <EOL> if tablename == "<STR_LIT>" : <EOL> if not tabs : <EOL> tabs = [ ( T ( "<STR_LIT>" ) , None ) , <EOL> ( T ( "<STR_LIT>" ) , "<STR_LIT>" ) , <EOL> ] <EOL> rheader_fields = [ [ "<STR_LIT:name>" ] , <EOL> [ "<STR_LIT>" ] , <EOL> ] <EOL> else : <EOL> if not tabs : <EOL> tabs = [ ( T ( "<STR_LIT>" ) , None ) , <EOL> ] <EOL> rheader_fields = [ [ "<STR_LIT:name>" ] , <EOL> [ "<STR_LIT>" ] , <EOL> ] <EOL> if settings . has_module ( "<STR_LIT>" ) : <EOL> tabs . extend ( s3db . req_tabs ( r ) ) <EOL> if settings . has_module ( "<STR_LIT>" ) : <EOL> tabs . extend ( s3db . inv_tabs ( r ) ) <EOL> rheader = S3ResourceHeader ( rheader_fields , tabs ) ( r , <EOL> table = table , <EOL> record = record , <EOL> ) <EOL> return rheader </s>
