Skip to content

Redirects and DB transactions

Choose a tag to compare

@edelvalle edelvalle released this 03 Jun 21:31
· 341 commits to master since this release

Changes

Breaking changes:

  • Now the dispatching of incoming events from the front-end are not atomic transactions. You will have to put @atomic when you want something to be atomic. The reason for this is that some events don't have to deal at all with the database because they just change the local state of the component.

Added:

  • reactor.broadcast(*names): this broadcasts the messages that you can subscribe to using Component.subscribe().
  • Component.send_redirect(url): now you can send a URL redirect to the front-end, when the component is being rendered for first time the redirect is rendered as a <meta http-equiv="refresh" content="0; url={{ url }}">, if the component is alive then the front-end controller executes the redirect.
  • AuthComponent, this component has a user attributed taken from the Component._context and on mount if the user is authenticated returns the True, if the user is not returns None and sends a redirect to settings.LOGIN_URL.
  • Serialization of arrays in the front-end, in case you have:
    <input name="query" value="q">
    <input name="persons[].name" value="a">
    <input name="persons[].name" value="b">

This will be serialized as: {query: "q", persons: [{name: "a"}, {name: "b"}]}

Room for improvement:

  • Proper documentation.
  • More testing.