Ejemplo n.º 1
0
    def __init__(self, title=None, path=None, date=None):
        '''
        Initializes a new post and creates path to it if it doesn't already
        exist.
        '''
        self.title = title

        # get year, month and day from date
        self.year, self.month, self.day = utils.split_date(date)

        # get name from path if specified, otherwise from title
        if path:
            self.name = utils.name_from_path(path)
        else:
            self.name = utils.name_from_title(title)

        # create post directory if it doesn't exist and get post path
        self.path = os.path.join(
            utils.get_path(
                paths.root,
                self.year,
                self.month,
                self.day),
            self.name) + tinkerer.source_suffix

        # docname as it should appear in TOC
        self.docname = "/".join([self.year, self.month, self.day, self.name])
Ejemplo n.º 2
0
    def __init__(self, title=None, path=None, date=None):
        '''
        Initializes a new post and creates path to it if it doesn't already
        exist.
        '''
        self.title = title

        # get year, month and day from date
        self.year, self.month, self.day = utils.split_date(date)

        # get name from path if specified, otherwise from title
        if path:
            self.name = utils.name_from_path(path)
        else:
            self.name = utils.name_from_title(title)

        # create post directory if it doesn't exist and get post path
        self.path = os.path.join(
            utils.get_path(
                paths.root,
                self.year,
                self.month,
                self.day),
            self.name) + tinkerer.source_suffix

        # docname as it should appear in TOC
        self.docname = "/".join([self.year, self.month, self.day, self.name])
Ejemplo n.º 3
0
    def __init__(self, title=None, path=None):
        '''
        Determines page filename based on title or given path and creates the
        path to the page if it doesn't already exist.
        '''
        self.title = title

        # get name from path if specified, otherwise from title
        if path:
            self.name = utils.name_from_path(path)
        else:
            self.name = utils.name_from_title(title)

        # create page directory if it doesn't exist and get page path
        self.path = os.path.join(utils.get_path(paths.root, "pages"),
                                 self.name) + tinkerer.source_suffix

        # docname as it should appear in TOC
        self.docname = "pages/" + self.name
Ejemplo n.º 4
0
    def __init__(self, title=None, path=None):
        '''
        Determines page filename based on title or given path and creates the
        path to the page if it doesn't already exist.
        '''
        self.title = title

        # get name from path if specified, otherwise from title
        if path:
            self.name = utils.name_from_path(path)
        else:
            self.name = utils.name_from_title(title)

        # create page directory if it doesn't exist and get page path
        self.path = os.path.join(
            utils.get_path(paths.root, "pages"),
            self.name) + tinkerer.source_suffix

        # docname as it should appear in TOC
        self.docname = "pages/" + self.name