Exemple #1
0
    def __init__(self, root, dest):
        self.root = root
        if op.exists(dest):
            shutil.rmtree(dest)

        self.settings = Settings(parent_tmpl='_base.html')
        conf = op.join(self.root, 'settings.cfg')
        if op.exists(conf):
            self.settings.read(file(conf).read().decode('utf-8'))


        site_base_path = base_path(self.url)
        self.dest = op.join(dest, url2path(site_base_path[1:]))

        self.env = initialize_env(root)
        self.env.globals['site'] = self
        self.entries = []

        self.settings.meta = {}
        self.settings.meta['generator'] = "Conrad 2.6alpha"

        if self.settings.get('sitecallback'):
            callback = impcallback(self.settings.sitecallback, self.root)
            callback(self)

        self._traverse()
Exemple #2
0
    def __init__(self, root, dest):
        self.root = root
        if op.exists(dest):
            shutil.rmtree(dest)

        self.settings = Settings(parent_tmpl='_base.html')
        conf = op.join(self.root, 'settings.cfg')
        if op.exists(conf):
            self.settings.read(file(conf).read().decode('utf-8'))

        site_base_path = base_path(self.url)
        self.dest = op.join(dest, url2path(site_base_path[1:]))

        self.env = initialize_env(root)
        self.env.globals['site'] = self
        self.entries = []

        self.settings.meta = {}
        self.settings.meta['generator'] = "Conrad 2.6alpha"

        if self.settings.get('sitecallback'):
            callback = impcallback(self.settings.sitecallback, self.root)
            callback(self)

        self._traverse()
Exemple #3
0
def url_for(context, path):
    if not path:
        return ''
    basepath = utils.base_path(context['site'].url)
    return utils.relpath(
        utils.safe_url_join(basepath, context['entry'].get_relative_url()),
        utils.safe_url_join(basepath, path))
Exemple #4
0
 def get_url(self):
     return safe_url_join(base_path(self.site.url), self.get_relative_url())
Exemple #5
0
 def get_url(self):
     return safe_url_join(base_path(self.site.url), self.get_relative_url())