<s> """<STR_LIT>""" <EOL> def index ( ) : <EOL> """<STR_LIT>""" <EOL> module_name = T ( "<STR_LIT>" ) <EOL> response . title = module_name <EOL> return dict ( module_name = module_name ) <EOL> def config ( ) : <EOL> """<STR_LIT>""" <EOL> table = s3db . sync_config <EOL> record = db ( ) . select ( table . id , limitby = ( <NUM_LIT:0> , <NUM_LIT:1> ) ) . first ( ) <EOL> if not record : <EOL> record_id = table . insert ( ) <EOL> else : <EOL> record_id = record . id <EOL> def postp ( r , output ) : <EOL> if isinstance ( output , dict ) and "<STR_LIT>" in output : <EOL> output [ "<STR_LIT>" ] . pop ( "<STR_LIT>" , None ) <EOL> return output <EOL> s3 . postp = postp <EOL> r = s3_request ( args = [ str ( record_id ) , "<STR_LIT>" ] , extension = "<STR_LIT:html>" ) <EOL> return r ( ) <EOL> def repository ( ) : <EOL> """<STR_LIT>""" <EOL> s3db . set_method ( "<STR_LIT>" , "<STR_LIT>" , <EOL> method = "<STR_LIT>" , <EOL> action = current . sync , <EOL> ) <EOL> def prep ( r ) : <EOL> if r . interactive : <EOL> if not r . component : <EOL> field = r . table . uuid <EOL> field . label = "<STR_LIT>" <EOL> field . readable = True <EOL> field . writable = True <EOL> field . comment = DIV ( _class = "<STR_LIT>" , <EOL> _title = "<STR_LIT>" % ( <EOL> T ( "<STR_LIT>" ) , <EOL> T ( "<STR_LIT>" ) , <EOL> ) , <EOL> ) <EOL> script = "<STR_LIT>" if s3 . debug else "<STR_LIT>" <EOL> path = "<STR_LIT>" % ( appname , script ) <EOL> if path not in s3 . scripts : <EOL> s3 . scripts . append ( path ) <EOL> elif r . id : <EOL> alias = r . component . alias <EOL> if alias == "<STR_LIT>" : <EOL> apitype = r . record . apitype <EOL> if apitype == "<STR_LIT>" : <EOL> component_table = r . component . table <EOL> for fname in ( "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ) : <EOL> field = component_table [ fname ] <EOL> field . readable = field . writable = True <EOL> infile_pattern = "<STR_LIT>" <EOL> outfile_pattern = "<STR_LIT>" <EOL> human_readable = "<STR_LIT>" <EOL> delete_input_files = "<STR_LIT>" <EOL> else : <EOL> infile_pattern = None <EOL> outfile_pattern = None <EOL> human_readable = None <EOL> delete_input_files = None <EOL> crud_form = s3base . S3SQLCustomForm ( <EOL> "<STR_LIT>" , <EOL> infile_pattern , <EOL> delete_input_files , <EOL> outfile_pattern , <EOL> human_readable , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> s3base . S3SQLInlineComponent ( <EOL> "<STR_LIT>" , <EOL> label = T ( "<STR_LIT>" ) , <EOL> fields = [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> ) , <EOL> ) <EOL> list_fields = [ "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> s3db . configure ( "<STR_LIT>" , <EOL> crud_form = crud_form , <EOL> list_fields = list_fields , <EOL> ) <EOL> elif alias == "<STR_LIT>" : <EOL> s3task . configure_tasktable_crud ( <EOL> function = "<STR_LIT>" , <EOL> args = [ r . id ] , <EOL> vars = { "<STR_LIT>" : auth . user . id if auth . user else <NUM_LIT:0> } , <EOL> period = <NUM_LIT> , <EOL> ) <EOL> elif alias == "<STR_LIT>" and r . component_id : <EOL> table = r . component . table <EOL> table . message . represent = lambda msg : DIV ( s3base . s3_strip_markup ( msg ) , <EOL> _class = "<STR_LIT>" , <EOL> ) <EOL> s3 . cancel = URL ( c = "<STR_LIT>" , <EOL> f = "<STR_LIT>" , <EOL> args = [ str ( r . id ) , alias ] , <EOL> ) <EOL> return True <EOL> s3 . prep = prep <EOL> def postp ( r , output ) : <EOL> if r . interactive and r . id : <EOL> if r . component and r . component . alias == "<STR_LIT>" : <EOL> s3 . actions = [ dict ( label = str ( T ( "<STR_LIT>" ) ) , <EOL> _class = "<STR_LIT>" , <EOL> url = URL ( c = "<STR_LIT>" , <EOL> f = "<STR_LIT>" , <EOL> args = [ str ( r . id ) , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] , <EOL> ) , <EOL> ) <EOL> ] <EOL> s3_action_buttons ( r ) <EOL> return output <EOL> s3 . postp = postp <EOL> tabs = [ ( T ( "<STR_LIT>" ) , None ) , <EOL> ( T ( "<STR_LIT>" ) , "<STR_LIT>" ) , <EOL> ( T ( "<STR_LIT>" ) , "<STR_LIT>" ) , <EOL> ( T ( "<STR_LIT>" ) , "<STR_LIT>" ) , <EOL> ] <EOL> rheader = lambda r : s3db . sync_rheader ( r , tabs = tabs ) <EOL> return s3_rest_controller ( "<STR_LIT>" , "<STR_LIT>" , rheader = rheader ) <EOL> def sync ( ) : <EOL> """<STR_LIT>""" <EOL> tablename = get_vars . get ( "<STR_LIT>" ) <EOL> if not tablename or tablename == "<STR_LIT>" : <EOL> mixed = True <EOL> tablename = "<STR_LIT>" <EOL> else : <EOL> mixed = False <EOL> if tablename and "<STR_LIT:_>" in tablename : <EOL> get_vars_new = Storage ( include_deleted = True ) <EOL> for k , v in get_vars . items ( ) : <EOL> if k in ( "<STR_LIT>" , "<STR_LIT>" ) or k [ <NUM_LIT:0> ] == "<STR_LIT:[>" and "<STR_LIT:]>" in k : <EOL> get_vars_new [ k ] = v <EOL> prefix , name = tablename . split ( "<STR_LIT:_>" , <NUM_LIT:1> ) <EOL> r = s3_request ( prefix = prefix , <EOL> name = name , <EOL> args = [ "<STR_LIT>" ] , <EOL> get_vars = get_vars_new , <EOL> ) <EOL> output = r ( mixed = mixed ) <EOL> return output <EOL> raise HTTP ( <NUM_LIT> , body = current . ERROR . BAD_REQUEST ) <EOL> def log ( ) : <EOL> """<STR_LIT>""" <EOL> if "<STR_LIT>" in get_vars : <EOL> c , f = get_vars [ "<STR_LIT>" ] . split ( "<STR_LIT:.>" , <NUM_LIT:1> ) <EOL> list_btn = URL ( c = c , f = f , args = "<STR_LIT>" ) <EOL> else : <EOL> list_btn = URL ( c = "<STR_LIT>" , f = "<STR_LIT>" , vars = get_vars ) <EOL> list_btn = A ( T ( "<STR_LIT>" ) , _href = list_btn , _class = "<STR_LIT>" ) <EOL> def prep ( r ) : <EOL> if r . record : <EOL> r . table . message . represent = lambda msg : DIV ( s3base . s3_strip_markup ( msg ) , <EOL> _class = "<STR_LIT>" , <EOL> ) <EOL> return True <EOL> s3 . prep = prep <EOL> output = s3_rest_controller ( "<STR_LIT>" , "<STR_LIT>" , <EOL> subtitle = None , <EOL> rheader = s3base . S3SyncLog . rheader , <EOL> list_btn = list_btn , <EOL> ) <EOL> return output <EOL> def task ( ) : <EOL> """<STR_LIT>""" <EOL> s3 . prep = lambda r : r . representation == "<STR_LIT>" and r . method == "<STR_LIT>" <EOL> return s3_rest_controller ( ) </s>
