posty.model module

class posty.model.ABC[source]

Bases: object

class posty.model.Model(payload, config=None)[source]

Bases: posty.model.ABC, _abcoll.MutableMapping

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

  • payload – A dict representing the backing payload for this object
  • config – A Config object

Return a true dict representation of this object, suitable for serialization into JSON or YAML

classmethod from_yaml(file_contents, config=None)[source]

Load an object from its YAML file representation


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


Returns the URL path to this resource


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