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

Parameters:
  • payload – A dict representing the backing payload for this object
  • config – A Config object
as_dict()[source]

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

path_on_disk()[source]

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

url()[source]

Returns the URL path to this resource

validate()[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