except Exception as err: print err print 'ERROR: DB creation error. Database tables already exist' print 'Delete tables or database to reinitialize' elif COMMAND == 'load_records': admin.load_records(CONTEXT, DATABASE, TABLE, XML_DIRPATH, RECURSIVE, FORCE_CONFIRM) elif COMMAND == 'export_records': admin.export_records(CONTEXT, DATABASE, TABLE, XML_DIRPATH) elif COMMAND == 'rebuild_db_indexes': admin.rebuild_db_indexes(DATABASE, TABLE) elif COMMAND == 'optimize_db': admin.optimize_db(CONTEXT, DATABASE, TABLE) elif COMMAND == 'refresh_harvested_records': admin.refresh_harvested_records(CONTEXT, DATABASE, TABLE, URL) elif COMMAND == 'gen_sitemap': admin.gen_sitemap(CONTEXT, DATABASE, TABLE, URL, OUTPUT_FILE) elif COMMAND == 'post_xml': print admin.post_xml(CSW_URL, XML, TIMEOUT) elif COMMAND == 'get_sysprof': print admin.get_sysprof() elif COMMAND == 'validate_xml': admin.validate_xml(XML, XSD) elif COMMAND == 'delete_records': if not FORCE_CONFIRM: if raw_input('This will delete all records! Continue? [Y/n] ') == 'Y': FORCE_CONFIRM = True if FORCE_CONFIRM: admin.delete_records(CONTEXT, DATABASE, TABLE) print 'Done'
def handle_validate(self, args): admin.validate_xml(args.xml, args.xml_schema)
print(err) print('ERROR: DB creation error. Database tables already exist') print('Delete tables or database to reinitialize') elif COMMAND == 'load_records': admin.load_records(CONTEXT, DATABASE, TABLE, XML_DIRPATH, RECURSIVE, FORCE_CONFIRM) elif COMMAND == 'export_records': admin.export_records(CONTEXT, DATABASE, TABLE, XML_DIRPATH) elif COMMAND == 'rebuild_db_indexes': admin.rebuild_db_indexes(DATABASE, TABLE) elif COMMAND == 'optimize_db': admin.optimize_db(CONTEXT, DATABASE, TABLE) elif COMMAND == 'refresh_harvested_records': admin.refresh_harvested_records(CONTEXT, DATABASE, TABLE, URL) elif COMMAND == 'gen_sitemap': admin.gen_sitemap(CONTEXT, DATABASE, TABLE, URL, OUTPUT_FILE) elif COMMAND == 'post_xml': print(admin.post_xml(CSW_URL, XML, TIMEOUT)) elif COMMAND == 'get_sysprof': print(admin.get_sysprof()) elif COMMAND == 'validate_xml': admin.validate_xml(XML, XSD) elif COMMAND == 'delete_records': if not FORCE_CONFIRM: if input('This will delete all records! Continue? [Y/n] ') == 'Y': FORCE_CONFIRM = True if FORCE_CONFIRM: admin.delete_records(CONTEXT, DATABASE, TABLE) print('Done')