posty.model module

class posty.model.ABC[source]

Bases: object

class posty.model.Model[source]

Bases: ABC

Base class for objects representing things stored as YAML, such as a Post or a Page

Parameters:
  • payload – A dict representing the backing payload for this object

  • config – A Config object

property config: Config
abstractmethod classmethod from_yaml(file_contents: str, config: Config | None = None) Model[source]

Load an object from its YAML file representation

abstractmethod path_on_disk() str[source]

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

abstractmethod url() Any[source]

Returns the URL path to this resource

abstractmethod 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