posty.post module

class posty.post.Post(title: str, date: ~datetime.date, blurb: str, body: str, _config: ~posty.config.Config | None, slug: str = '', tags: list[str] = <factory>)[source]

Bases: Model

Representation of a post

blurb: str
body: str
date: date
classmethod from_yaml(file_contents: str, config: Config | None = None) Post[source]

Returns a Post from the given file_contents

path_on_disk() str[source]

Returns the relative path on disk to the object, for rendering purposes

slug: str = ''
tags: list[str]
title: str
to_yaml() str[source]

Returns the YAML and text representation of this Post. This is the reverse of from_yaml()

url() Any[source]

Returns the URL path to this resource

validate() None[source]

This should be implemented by the child class to verify that all fields that are expected exist on the payload, and set any that aren’t