Gramex 1.74 release notes

Gramex 1.74’s admin app lets administrators add new users, welcome them via email, add custom fields and roles for users based on rules, and more.

Add new users on Admin app

Admin app’s user management component lets administrators add new users via the user interface.

Example of how to to add new user

You can send welcome emails to new users added through this interface with the configuration below:

import:
  admin/admin-user:
    path: $GRAMEXAPPS/admin2/gramex.yaml
    YAMLURL: /$YAMLURL/admin-user/
    ADMIN_KWARGS:
      authhandler: login # Manages users via the url: key named "login"
      signup:
        email_subject: Welcome {user} to {org}
        email_body: |
          Hello, {user}! Welcome to {org}.
          Your location is {location}.

Thanks @jaidevd

Add custom fields and roles for users

Admin app’s user management component also includes an editor for the rules that modify user attributes.

Example of how to to add new rules

The rule we added works as follows:

To enable this, add a rules: section to the auth handler.

url:
  auth:
    pattern: /$YAMLURL/login
    handler: SimpleAuth # Any auth handler works
    kwargs:
      rules:
        url: sqlite:///path/to/rules.db # Connect to rules DB / file
        table: rules

Thanks @jaidevd

UIFactory inline scripts

To add logic to your component, add any JavaScript inside <script $inline>. This runs when the component is rendered.

<template $name="repeat-script" icon="X" value="30">
  <script $inline>
    let count = +value;
    let result = isNaN(count) ? "error" : icon.repeat(count);
  </script>
  ${result}
</template>

When you add the component to your page:

<repeat-script icon="★" value="8"></repeat-html>
<repeat-script icon="★" value="a"></repeat-html>

… it renders this output:

★★★★★★★★

Thanks @jaidevd

Bug fixes

Backward compatibility & security

Gramex 1.74 is backward compatible with previous releases unless the release notes say otherwise. Automated builds test this.

Every Gramex release is tested for security vulnerabilities using the following tools.

  1. Bandit tests for back-end Python vulnerabilities. See Bandit results
  2. npm-audit tests for front-end JavaScript vulnerabilities. See npm-audit results
  3. Snyk for front-end and back-end vulnerabilities. See Synk results
  4. ClamAV for anti-virus scans. See ClamAV results

Statistics

The Gramex code base has:

How to install

See the Gramex installation and upgrade instructions.

Note: Gramex 1.74 does not work with Python 3.8 or 3.9. We recommend Python 3.7.