def write(self, content=""): ''' Writes the page template. ''' writer.render(paths.page_template, self.path, { "title": self.title, "content": content })
def create(title, template=None): ''' Creates a new post draft. ''' name = utils.name_from_title(title) template = template or paths.post_template path = os.path.join( utils.get_path(paths.root, "drafts"), name + tinkerer.source_suffix, ) if os.path.exists(path): raise Exception("Draft '%s' already exists at '%s" % (title, path)) writer.render( template, path, { "title": title, "content": "", "author": "default", "categories": "none", "tags": "none" }) return path
def create(title, template=None): ''' Creates a new post draft. ''' name = utils.name_from_title(title) template = template or paths.post_template path = os.path.join( utils.get_path( paths.root, "drafts"), name + tinkerer.source_suffix) if os.path.exists(path): raise Exception("Draft '%s' already exists at '%s" % (title, path)) writer.render(template, path, { "title" : title, "content" : "", "author" : "default", "categories": "none", "tags" : "none"}) return path
def write(self, content="", template=None): ''' Writes the page template. ''' template = template or paths.page_template writer.render(template, self.path, {"title": self.title, "content": content})
def write(self, content="", template=None): ''' Writes the page template. ''' template = template or paths.page_template writer.render(template, self.path, { "title": self.title, "content": content })
def write(self, content="", author="default", categories="none", tags="none"): ''' Writes the post template with given arguments. ''' writer.render(paths.post_template, self.path, { "title" : self.title, "content" : content, "author" : author, "categories": categories, "tags" : tags})
def write(self, content="", author="default", categories="none", tags="none", template=None): ''' Writes the post template with given arguments. ''' template = template or paths.post_template writer.render(template, self.path, {"title": self.title, "content": content, "author": author, "categories": categories, "tags": tags})
def create(title): ''' Creates a new post draft. ''' name = utils.name_from_title(title) path = os.path.join( utils.get_path( paths.root, "drafts"), name + tinkerer.source_suffix) writer.render(paths.post_template, path, { "title" : title, "content" : "", "author" : "default", "categories": "none", "tags" : "none"}) return path