gristlabs_grist-core/sandbox/grist/functions
Paul Fitzpatrick 0c5f7cf0a7 (core) add SELF_HYPERLINK() function for generating links to the current document
Summary:
 * Adds a `SELF_HYPERLINK()` python function, with optional keyword arguments to set a label, the page, and link parameters.
 * Adds a `UUID()` python function, since using python's uuid.uuidv4 hits a problem accessing /dev/urandom in the sandbox.  UUID makes no particular quality claims since it doesn't use an audited implementation.  A difficult to guess code is convenient for some use cases that `SELF_HYPERLINK()` enables.

The canonical URL for a document is mutable, but older versions generally forward.  So for implementation simplicity the document url is passed it on sandbox creation and remains fixed throughout the lifetime of the sandbox.  This could and should be improved in future.

The URL is passed into the sandbox as a `DOC_URL` environment variable.

The code for creating the URL is factored out of `Notifier.ts`. Since the url is a function of the organization as well as the document, some rejiggering is needed to make that information available to DocManager.

On document imports, the new document is registered in the database slightly earlier now, in order to keep the procedure for constructing the URL in different starting conditions more homogeneous.

Test Plan: updated test

Reviewers: dsagal

Reviewed By: dsagal

Differential Revision: https://phab.getgrist.com/D2759
2021-03-18 19:37:07 -04:00
..
__init__.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
date.py (core) Fix lookups in default formulas 2020-09-10 18:06:06 -04:00
info.py (core) Improve suggestions for formula autocomplete 2020-09-12 00:21:29 -04:00
logical.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
lookup.py (core) add SELF_HYPERLINK() function for generating links to the current document 2021-03-18 19:37:07 -04:00
math.py (core) add SELF_HYPERLINK() function for generating links to the current document 2021-03-18 19:37:07 -04:00
schedule.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
stats.py (core) Improve suggestions for formula autocomplete 2020-09-12 00:21:29 -04:00
test_schedule.py (core) move data engine code to core 2020-07-29 08:57:25 -04:00
text.py (core) Fix CONCAT function that was breaking on presence of non-ascii characters 2021-03-09 16:27:48 -05:00
unimplemented.py (core) Improve suggestions for formula autocomplete 2020-09-12 00:21:29 -04:00