Changeset 3826 for sqlitetopgscript
- Timestamp:
- 06/12/08 00:06:57 (5 months ago)
- Files:
-
- sqlitetopgscript/0.10/sqlite2pg (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sqlitetopgscript/0.10/sqlite2pg
r3707 r3826 1 #!/usr/bin/ python1 #!/usr/bin/env python 2 2 3 3 # -*- coding: utf-8 -*- … … 66 66 def migrateTable(self, table): 67 67 """ Migrate the table specified. """ 68 if not opts.noclean:68 if not self.opts.noclean: 69 69 self.cleanTable(table) 70 70 m = getattr(self, ''.join(['migrate_', table.upper()]), None) … … 130 130 pgcur = self.pgdb.cursor() 131 131 rows = row_exists = 0 132 if not opts.plist:132 if not self.opts.plist: 133 133 sql_select = "SELECT * FROM permission" 134 134 else: … … 164 164 pgcur = self.pgdb.cursor() 165 165 rows = row_exists = 0 166 if not opts.wlist:166 if not self.opts.wlist: 167 167 sql_select = "SELECT * FROM wiki" 168 168 else: … … 256 256 return rc 257 257 258 def doArgs( ):258 def doArgs(argv): 259 259 """ Look if you can't guess what this function does, just give up now. """ 260 260 global VERSION … … 291 291 default=False) 292 292 293 (options, args) = parser.parse_args( )293 (options, args) = parser.parse_args(argv) 294 294 if not options.tracenv: 295 295 if not options.tracbase: … … 303 303 options.tracenv = os.path.join(options.tracbase, args[0]) 304 304 305 if not options.pg_uri .startswith('postgres://'):305 if not options.pg_uri or not options.pg_uri.startswith('postgres://'): 306 306 print ("You must specify a valid URI for the PostgreSQL database.") 307 307 print (" eg. postgres://user:password@localhost/dbname") 308 308 sys.exit(1) 309 309 310 if not options.sqlite_uri .startswith('sqlite:'):310 if not options.sqlite_uri or not options.sqlite_uri.startswith('sqlite:'): 311 311 print ("You must specify a valid URI for the SQLite database.") 312 312 print (" eg. sqlite:db/trac.db") … … 327 327 328 328 329 def main(argv): 330 opts = doArgs(argv) 331 Main(opts) 332 return 0 333 329 334 if __name__ == '__main__': 330 opts = doArgs() 331 Main(opts) 332 sys.exit(0) 335 sys.exit(main(sys.argv[1:])) 333 336
