gen_vhost.pro.write_template module

Module
write_template.py
Copyright
Copyright (C) 2017 Vladimir Roncevic <elektron.ronca@gmail.com> gen_vhost is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. gen_vhost is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
Info
Defined class WriteTemplate with attribute(s) and method(s). Created API for writing a template content with parameters.
class gen_vhost.pro.write_template.WriteTemplate(verbose=False)[source]

Bases: ats_utilities.config_io.base_check.FileChecking

Defined class WriteTemplate with attribute(s) and method(s). Created API for writing a template content with parameters. It defines:

attributes:
GEN_VERBOSE - console text indicator for process-phase.
MOD - module key for template.
MODLC - module key lower case for template.
DATE - date key for template.
YEAR - year key for template.
PORTS - ports key for template.
SERVER - server key for template.
ROOT_DOC - root doc key for template.
ADMIN_EMAIL - administrator email key for template.
TARGET_DIR - target directory key for template.
URL - url key for template.
methods:
__init__ - initial constructor.
write - write a template content with parameters.
__str__ - dunder method for WriteTemplate.
ADMIN_EMAIL = 'admin_email'
DATE = 'date'
GEN_VERBOSE = 'GEN_VHOST::PRO::WRITE_TEMPLATE'
MOD = 'mod'
MODLC = 'modlc'
PORTS = 'ports'
ROOT_DOC = 'root_doc'
SERVER = 'server_name'
TARGET_DIR = 'target_dir'
URL = 'url'
VERBOSE = 'ATS_UTILITIES'
YEAR = 'year'
write(module_content, module_name, module_file, verbose=False)[source]

Write a template content with parameters to a file.

Parameters:
  • module_content (<str>) – template content.
  • module_name (<str>) – file name.
Returns:

boolean status, True (success) | False.

Return type:

<bool>

Exception:

ATSBadCallError | ATSTypeError