Esempio n. 1
0
    def __init__(self, config):
        Parser.__init__(self)
        self.read(config)

        self.dst_db = self.get('main', 'dst_db', cls=Sql)
        self.src_db = self.get('main', 'src_db', cls=Sql)

        self.dst_attach_path = self.get('main', 'dst_attachments_path')
        self.src_attach_path = self.get('main', 'src_attachments_path')

        self.dst_page_path = self.get('main', 'dst_page_path')
Esempio n. 2
0
    def load(self, options):
        if 'morias_config' in options:
            inifile = options.get('morias_config')
            # TODO: check if file is readable
            app.log_error('Read config from file ...', state.LOG_INFO)
            p = Parser()
            p.read(inifile)
        else:
            app.log_error('Read config from options ...', state.LOG_INFO)
            p = Options(options)
        # endif

        self.debug = p.get('morias', 'debug', False, cls=bool)

        self.templates = p.get('morias', 'templates', cls=Paths)
        self.footers = []    # modules could append path for it's footer
        self.modules = p.get('morias', 'modules', cls=tuple)
        self.langs = p.get('morias', 'langs', 'en,cs', cls=tuple)
        self.locales = p.get('morias', 'locales', 'locales/')

        self.site_name = p.get('site', 'name', "Morias")
        self.site_description = p.get('site', 'description', "cms")
        self.site_keywords = p.get('site', 'keywords', '', cls=tuple)
        self.site_author = p.get('site', 'author', '')
        self.site_copyright = p.get('site', 'copyright',
                                    strftime("%%Y %s" %
                                             self.site_author.encode('utf-8')))
        self.site_styles = p.get('site', 'styles', '', cls=tuple)

        self.options = {
            'morias': {
                'langs': {'morias.core':
                          ('en,cs', list, self.langs, True, '')},
            },
            'site': {
                'name':         {'morias.core':
                                 ('Morias', unicode, self.site_name,
                                  True, '')},
                'description':  {'morias.core':
                                 ('cms', unicode, self.site_description,
                                  True, '')},
                'keywords':     {'morias.core':
                                 ('', tuple, self.site_keywords, True, '')},
                'author':       {'morias.core':
                                 ('', unicode, self.site_author, True, '')},
                'copyright':    {'morias.core':
                                 ('', unicode, self.site_copyright, True, '')},
            }
        }

        for module in self.modules:
            app.log_error('Loading module %s' % module, state.LOG_INFO)
            self.load_module(p, module)

        """