예제 #1
0
파일: core.py 프로젝트: Xalior/conrad
    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()
예제 #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()
예제 #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))
예제 #4
0
파일: models.py 프로젝트: Xalior/conrad
 def get_url(self):
     return safe_url_join(base_path(self.site.url), self.get_relative_url())
예제 #5
0
파일: models.py 프로젝트: Xalior/conrad
 def get_url(self):
     return safe_url_join(base_path(self.site.url), self.get_relative_url())