Ticket #3148: main_ep.diff

File main_ep.diff, 1.8 kB (added by alberto@toscat.net, 7 months ago)

The patch

  • sqlite2pg

    old new  
    1 #!/usr/bin/python 
     1#!/usr/bin/env python 
    22 
    33# -*- coding: utf-8 -*- 
    44# 
     
    6565 
    6666    def migrateTable(self, table): 
    6767        """ Migrate the table specified. """ 
    68         if not opts.noclean: 
     68        if not self.opts.noclean: 
    6969            self.cleanTable(table) 
    7070        m = getattr(self, ''.join(['migrate_', table.upper()]), None) 
    7171        if not m: 
     
    129129        scur = self.sdb.cursor() 
    130130        pgcur = self.pgdb.cursor() 
    131131        rows = row_exists = 0 
    132         if not opts.plist: 
     132        if not self.opts.plist: 
    133133            sql_select = "SELECT * FROM permission" 
    134134        else: 
    135135            subs = [] 
     
    163163        scur = self.sdb.cursor() 
    164164        pgcur = self.pgdb.cursor() 
    165165        rows = row_exists = 0 
    166         if not opts.wlist: 
     166        if not self.opts.wlist: 
    167167            sql_select = "SELECT * FROM wiki" 
    168168        else: 
    169169            subs = [] 
     
    255255    
    256256    return rc 
    257257 
    258 def doArgs(): 
     258def doArgs(argv): 
    259259    """ Look if you can't guess what this function does, just give up now. """ 
    260260    global VERSION 
    261261    
     
    290290                        help="Do not clear PostgreSQL tables before transfer", 
    291291                        default=False) 
    292292    
    293     (options, args) = parser.parse_args(
     293    (options, args) = parser.parse_args(argv
    294294    if not options.tracenv: 
    295295        if  not options.tracbase: 
    296296            print ("You must specify the --tracenv or the --tracbase option") 
     
    326326    return options 
    327327 
    328328 
     329def main(argv): 
     330    opts = doArgs(argv) 
     331    Main(opts) 
     332    return 0 
     333 
    329334if __name__ == '__main__': 
    330     opts = doArgs() 
    331     Main(opts) 
    332     sys.exit(0) 
     335    sys.exit(main(sys.argv[1:])) 
    333336