def setup_xml(xml_params): ''' Imports XML file(s) ''' from libs.ConfigManager import ConfigManager # Sets up logging from setup.xmlsetup import import_xml for index, xml_param in enumerate(xml_params): print(INFO + "Processing %d of %d .xml file(s) ..." % (index + 1, len(xml_params))) import_xml(xml_param) print(INFO+"%s : Completed processing of all .xml file(s)" % current_time())
def setup_xml(xml_params): """ Imports XML file(s) """ from setup.xmlsetup import import_xml for index, xml_param in enumerate(xml_params): print(INFO + "Processing %d of %d .xml file(s) ..." % (index + 1, len(xml_params))) import_xml(xml_param) print(INFO + "%s : Completed processing of all .xml file(s)" % (current_time()))
def post(self, *args, **kwargs): ''' Import XML file uploaded by the admin. ''' if 'xml_file' in self.request.files: fxml = self._get_tmp() errors = [] success = None if import_xml(fxml): success = "Successfully imported XML objects" else: errors.append("Failed to parse file correctly.") os.unlink(fxml) self.render('admin/import.html', success=success, errors=errors) else: self.render('admin/import.html', success=None, errors=["No file data."])
def post(self, *args, **kwargs): """ Import XML file uploaded by the admin. """ if "xml_file" in self.request.files: fxml = self._get_tmp_file() errors = [] success = None if import_xml(fxml): success = "Successfully imported XML objects" else: errors.append("Failed to parse file correctly.") os.unlink(fxml) self.refresh_app_config() self.render("admin/import.html", success=success, errors=errors) else: self.render("admin/import.html", success=None, errors=["No file data."])