clientonly = True client = AppInfoClient() if any([options.createdb, options.updatepkgdb, options.resetdb, len(args) > 1]): clientonly = False server = AppInfoServer() print ' - Trying to initialize Server DB:', server.initializeDB(options.filename)[1] if options.createdb: print ' - Trying to create db:' , server.createDB(options.filename or 'appinfo.db')[1] if options.updatepkgdb: print ' - Trying to update packagelist:', server.updatePackageList()[1] if options.resetdb: print ' - Trying to reset scores:', server.resetPackageScores() if not options.resetdb and len(args) > 1: print ' - Trying to update package "%s" score:' % args[0], server.updatePackageScore(args[0], float(args[1]))[1] if clientonly: if not options.server == '': client.setServer(options.server) if options.updatedb: update_db = client.checkOutDB() if update_db[0]: print ' - Trying to update local db from: %s' % client.remote_db, client.checkOutDB()[1] else: print ' - Trying to update local db:', update_db[1] if options.filename: init_db = client.initializeDB(options.filename) else: init_db = client.initializeLocalDB()
print print ' - Trying to create db:' print ' ', server.createDB()[1] print print ' - Trying to update packagelist:' print ' ', server.updatePackageList()[1] print print ' - Trying to initialize Client DB:' print ' ', client.initializeDB()[1] print print ' - Trying to get score for package "yali":' print ' ', client.getPackageScore('yali') print print ' - Trying to update package "yali" score:' print ' ', server.updatePackageScore('yali', 5)[1] print print ' - Trying to get score for package "yali":' print ' ', client.getPackageScore('yali') print print ' - Trying to reset package score:' print ' ', server.resetPackageScores('yali')[1] print print ' - Trying to get score for package "yali":' print ' ', client.getPackageScore('yali') print print ' - Get AppInfo Client dir:' print ' ', client.path print print ' - Remote Server Test' print ' ------------------'
]): clientonly = False server = AppInfoServer() print ' - Trying to initialize Server DB:', server.initializeDB( options.filename)[1] if options.createdb: print ' - Trying to create db:', server.createDB(options.filename or 'appinfo.db')[1] if options.updatepkgdb: print ' - Trying to update packagelist:', server.updatePackageList()[1] if options.resetdb: print ' - Trying to reset scores:', server.resetPackageScores() if not options.resetdb and len(args) > 1: print ' - Trying to update package "%s" score:' % args[ 0], server.updatePackageScore(args[0], float(args[1]))[1] if clientonly: if not options.server == '': client.setServer(options.server) if options.updatedb: update_db = client.checkOutDB() if update_db[0]: print ' - Trying to update local db from: %s' % client.remote_db, client.checkOutDB( )[1] else: print ' - Trying to update local db:', update_db[1] if options.filename: init_db = client.initializeDB(options.filename) else: init_db = client.initializeLocalDB()
print print ' - Trying to create db:' print ' ',server.createDB()[1] print print ' - Trying to update packagelist:' print ' ', server.updatePackageList()[1] print print ' - Trying to initialize Client DB:' print ' ', client.initializeDB()[1] print print ' - Trying to get score for package "yali":' print ' ', client.getPackageScore('yali') print print ' - Trying to update package "yali" score:' print ' ', server.updatePackageScore('yali', 5)[1] print print ' - Trying to get score for package "yali":' print ' ', client.getPackageScore('yali') print print ' - Trying to reset package score:' print ' ', server.resetPackageScores('yali')[1] print print ' - Trying to get score for package "yali":' print ' ', client.getPackageScore('yali') print print ' - Get AppInfo Client dir:' print ' ', client.path print print ' - Remote Server Test' print ' ------------------'