fail (message)

  • Method of Publisher
  • New in Lektor Version 2.0

This method takes a message and raises an appropriate failure that aborts the publishing process. This is invoked from within the publish method to indicate a failure:

Example

from lektor.publisher import Publisher


class MyPublisher(Publisher):
    def publish(self, target_url, credentials=None, **extra):
        self.fail('This publisher cannot publish :(')


class MyPlugin(Plugin):
    def on_setup_env(self, **extra):
        self.env.add_publisher('my', MyPublisher)

Comments