model_classes = [] for entry in GAE_BACKUP_MODELS: __import__(entry[0]) for model in entry[1]: try: model_classes.append( db._kind_map[model] ) except KeyError , e: print "%s not found." % model print "Available models" print [key for key in db._kind_map] if options.output: output_path = options.output else: output_path = timestamp if not os.path.exists(output_path): os.mkdir(output_path) for model_class in model_classes: filename = output_path + "/%s.json" % model_class.kind() print "Saving changes to %s" % filename result = app.download_model(model_class) file = BackupFile(filename = filename, model_class = model_class) file.save(result)