Anvil Extras v2.0

We’ve just released Anvil Extras v2.0.0 with:

Breaking Changes

  • routing.load_form() was removed. Use routing.set_url_hash() instead.

This is our first breaking change (hence this being version 2.0 rather than 1.10). If you have apps using routing.load_form(), you should ensure that the dependency is pinned to version 1.9 and only upgrade once you have changed all instances of that call to routing.set_url_hash()

New Features

  • Popovers - supports changing the default container to something other than "body"
    add dismiss_on_scroll() and set_default_container() methods
  • Quill - adds a sanitize property and a sanitize kwarg to the set_html() method
  • routing - adds support for multiple top level forms
    • @routing.template(path='', priority=0, condition=None)
      A template form is a top level form that holds the header, navigation bar, side panel and an empty content_panel.
      When navigating the routing module will ensure the correct template is the current open_form based on the priority, path, and condition. The current url_hash must start with the path, and if a condition is set it must return True.
      Templates are checked order of priority, highest values first.
    • @routing.default_template replaces @routing.main_router.
      The @main_router decorator is still available. @default_template is equivalent to @template()
    • routing.NavigationExit()
      when raised within a template's on_navgation callback, this will prevent the routing module from changing the content_panel.
      This is useful if you have a LoginForm as a template whose content should remain unchanged when the user tries to navigate to other routes.
    • routing.launch()
      called within a startup module, replaces the call to open_form().
      routing.launch() checks the current url_hash and ensures that the correct template is loaded based on the paramaters of each template.
      Calling routing.set_url_hash() in a Startup Module will have no effect on form loading until routing.launch() has been called. (This allows you to change the url_hash within the startup logic)
  • logging module
    Small, simple, lightweight API for logging in anvil apps, a bit like the Python logging module.
    See the docs:

Bug fixes

  • Multi-select - fix button clicks don’t always close the dropdown menu
  • fix bug with @timed decorator if used with keyword logger and level arguments
12 Likes

Now at v2.0.1 with:

BugFixes:

  • routing - fix regression with before unload

Thanks to @stefano.menci for finding that one and @stucork for fixing it!

5 Likes

Hey @owen.campbell !

The example app of routing isn’t working. Accessing article #1 and reloading the page takes us to home page.

https://anvil-extras.readthedocs.io/en/latest/guides/modules/routing.html

I’ve cloned the app and the behavior is the same. The anvil-extras dependency is broken, I just removed and added it again.

Added a github issue: Routing not working in provided example · Issue #425 · anvilistas/anvil-extras · GitHub