Example #1
0
    def __init__(self, template):
        self.BASENAME = template.lower()
        self.PATH = TEAX_REAL_PATH + '/templates/' + self.BASENAME

        if not os.path.exists(self.PATH):
            tty.error(T_TEMPLATE_NOT_EXISTS % self.BASENAME)

        tty.info(T_USING_TEMPLATE % self.BASENAME)
Example #2
0
    def save(self, path):
        _document_name = slugify(path)
        _local_path = TEAX_WORK_PATH + '/' + _document_name

        if os.path.exists(_local_path):
            timestamp = str(int(time.time()))
            _local_path += '-' + timestamp
            tty.warning(T_DIRECTORY_EXISTS % timestamp)

        shutil.copytree(self.PATH, _local_path)

        tty.info(T_CREATING_TEMPLATE % _document_name)

        _conf_file = TEAX_WORK_PATH + '/' + _document_name + '/' + 'teax.ini'

        conf.save(_conf_file, [
            'general.title',
            'general.authors',
            'general.keywords'
        ])