thorn.generic.models — Thorn 1.3.0 documentation

# thorn.generic.models

- thorn.models

## thorn.models

Generic base model mixins.

class `thorn.generic.models.` `AbstractSubscriber`
  `as_dict`()

    Dictionary representation of Subscriber.

  `content_type`

    MIME-type to use for web requests made to the subscriber `url`.

  `event`

    Event pattern this subscriber is subscribed to (e.g. `article.*`).

  `from_dict`(*args, **kwargs)

    Create subscriber from dictionary representation.

    Accept the same arguments as `dict`.

  `hmac_digest`

    HMAC digest type (e.g. `"sha512"`).

    The value used must be a member of `hashlib.algorithms_available`.

  `hmac_secret`

    HMAC secret key, of arbitrary length.

  classmethod `register`(other)
  `sign`(message)

    Sign (HMAC) message using `hmac_secret` and the current `hmac_digest` type.

  `url`

    Destination URL to dispatch this event.

  `user`

    User filter: when set only dispatch if the event sender matches.

  `user_ident`()

    Return `user` identity, must be json serializable like a database primary key.

  `uuid`

    Unique identifier.

class `thorn.generic.models.` `SubscriberModelMixin`
  `as_dict`()
  classmethod `from_dict`(*args, **kwargs)
  `sign`(message)