kotti.message

kotti.message.validate_token(user, token, valid_hrs=24)[source]
>>> from kotti.testing import setUp, tearDown
>>> ignore = setUp()
>>> class User(object):
...     pass
>>> daniel = User()
>>> daniel.name = u'daniel'
>>> alice = User()
>>> alice.name = u'alice'
>>> token = make_token(daniel)
>>> validate_token(daniel, token)
True
>>> validate_token(alice, token)
False
>>> validate_token(daniel, 'foo')
False
>>> token = make_token(daniel, seconds=time.time() - 100000)
>>> validate_token(daniel, token)
False
>>> validate_token(daniel, token, valid_hrs=48)
True
>>> tearDown()
kotti.message.send_email(request, recipients, template_name, template_vars=None)[source]

General email sender.

Parameters:
  • request (kotti.request.Request) – current request.
  • recipients (list) – list of email addresses. Each email should be a string like: u‘“John Doe” <joedoe@foo.com>’.
  • template_name (string) – asset specification (e.g. ‘mypackage:templates/email.pt’)
  • template_vars (dict) – set of variables present on template.