Skip to content

Commit

Permalink
attachment attribute of result of current_context(); edits to Azure s…
Browse files Browse the repository at this point in the history
…etup; information about controlling access to interviews
  • Loading branch information
jhpyle committed Apr 29, 2024
1 parent ca392b9 commit 1da9bad
Show file tree
Hide file tree
Showing 12 changed files with 263 additions and 33 deletions.
66 changes: 64 additions & 2 deletions _data/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@
color: danger
"buttons-icons":
"height": !!int |-
437
439
"width": !!int |-
488
"yaml": |-
Expand Down Expand Up @@ -8218,7 +8218,7 @@
% endfor
"generators":
"height": !!int |-
234
230
"width": !!int |-
488
"yaml": |-
Expand Down Expand Up @@ -18863,6 +18863,68 @@
\ You said you don't know if you like\n mushrooms. Your ridiculous explanation\n\
\ was:\n\n ${ quote_paragraphs(reason_why_unsure) }\n % elif likes_mushrooms:\n\
\ Your favorite mushroom is ${ mushroom }.\n % endif\nmandatory: True"
"language-functions":
"height": !!int |-
630
"width": !!int |-
488
"yaml": |-
mandatory: True
code: |
helper.name.text = "Robot"
user.name.first = "Ursula"
user.name.last = "User"
user.gender = 'female'
user_alias.name.first = "Ursie"
user_alias.name.last = "User"
user_alias.gender = 'female'
other_user.name.first = "Harold"
other_user.name.last = "User"
other_user.gender = 'male'
users.clear()
users.append(user)
users.append(other_user)
users.gathered = True
company.name.text = "ABC, Inc."
other_company.name.text = "DEF, Inc."
thing.name.text = "apple tree"
single_list.clear()
single_list.appendObject()
single_list[0].name.first = "Fred"
single_list[0].name.last = "Smith"
single_list[0].gender = 'male'
single_list.gathered = True
multiple_list.clear()
multiple_list.appendObject()
multiple_list[-1].name.first = "Sally"
multiple_list[-1].name.last = "Jones"
multiple_list[-1].gender = 'female'
multiple_list.appendObject()
multiple_list[-1].name.first = "Peter"
multiple_list[-1].name.last = "Roberts"
multiple_list[-1].gender = 'male'
multiple_list.gathered = True
single_dict.clear()
single_dict.initializeObject('a')
single_dict['a'].name.text = 'Single thing in a dictionary'
single_dict.gathered = True
multiple_dict.clear()
multiple_dict.initializeObject('a')
multiple_dict['a'].name.text = 'First thing in a dictionary'
multiple_dict.initializeObject('b')
multiple_dict['b'].name.text = 'Second thing in a dictionary'
multiple_dict.gathered = True
single_set.clear()
single_set.add('single set item')
single_set.gathered = True
multiple_set.clear()
multiple_set.add('first item in a set')
multiple_set.add('second item in a set')
multiple_set.gathered = True
helpers.clear()
helpers.append(company)
helpers.append(other_company)
helpers.gathered = True
"life_story":
"yaml": |-
template: life_story
Expand Down
21 changes: 21 additions & 0 deletions _docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@ layout: docs
title: Change Log
short_title: Change Log
---
## [1.4.103](https://github.com/jhpyle/docassemble/releases/tag/v1.4.103) - 2024-04-29


### Added
- Interface in the Word sidebar for changing the Playground project.
- Additional language functions accessible through methods on standard
classes.
- `attachment` object of the result of `current_context()` containing
information about the attachment currently being assembled.


### Changed
- Changes to HTML for accessibility purposes.


### Fixed
- PostgreSQL error in multiserver configuration when two servers try
to delete a package at the same time.
- The `ask_object` feature did not work when `new_object_type` was
used with `.using()`.

## [1.4.102](https://github.com/jhpyle/docassemble/releases/tag/v1.4.102) - 2024-03-18


Expand Down
8 changes: 8 additions & 0 deletions _docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,10 @@ When the server starts, the value of `os locale` is appended to
`/etc/locale.gen` (if not already there in uncommented form) and
`locale-gen` and `update-locale` are run.

After changing `os locale`, you will need to restart your container
(`docker stop -t 600 <container ID>` followed by `docker start
<container ID>`).

## <a name="other os locales"></a>Other available locales

If your interviews use locale and language settings that your
Expand All @@ -2415,6 +2419,10 @@ When the server starts, each of the `other os locales` is appended to
`/etc/locale.gen` (if not already there in uncommented form) and
`locale-gen` and `update-locale` are run.

After changing `other os locales`, you will need to restart your
container (`docker stop -t 600 <container ID>` followed by `docker
start <container ID>`).

## <a name="server administrator email"></a>E-mail address of server administrator

On [Docker], you can provide an e-mail address to the [NGINX] web
Expand Down
37 changes: 28 additions & 9 deletions _docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2701,23 +2701,23 @@ The `current_context()` function will return an object with the
following attributes describing information about the context in which
Python code is executing:

* `session` the session ID of the current interview session
* `filename` the filename of the current interview session
* `package` the package of the current filename
* `question_id` the `id` of the current `question`, or `None` if there is
* `session` - the session ID of the current interview session
* `filename` - the filename of the current interview session
* `package` - the package of the current filename
* `question_id` - the `id` of the current `question`, or `None` if there is
no current `question` or the `question` does not have an `id`.
* `current_filename` the filename of the currently executing block
* `current_package` the package of the filename of the currently executing block
* `variable` the name of the last variable to be sought, or
* `current_filename` - the filename of the currently executing block
* `current_package` - the package of the filename of the currently executing block
* `variable` - the name of the last variable to be sought, or
`None` if there was no variable being sought.
* `current_section` the name of the current section, as determined by
* `current_section` - the name of the current section, as determined by
the `section` modifier of the latest `question` **docassemble**
tried to process. In most situations, you will want to use
`nav.get_section()` instead. The `current_section` is useful if your
Python code needs to know the `section` modifier of the `question`
that **docassemble** is currently trying to display (which might not
be the same `question` that ultimately is displayed).
* `inside_of` the document assembly context, if any. The possible
* `inside_of` - the document assembly context, if any. The possible
values are `'standard'`, `'docx'`, `'pdf'`, `'pandoc'`, `'raw'`,
`'md'`, and `'html'`. The default context is `'standard'`; the other
contexts are in effect if code is executing to assemble a file using
Expand All @@ -2726,6 +2726,21 @@ Python code is executing:
file, or creation of an HTML version of a Markdown file (typically
used with the Pandoc document assembly system as an HTML preview of
the output).
* `attachment` - if the code that is currently executing is inside of a
document assembly process, this is an object with attributes
that relate to the document being assembled.
* `attachment.name` - the name of the document, as specified in the
[`attachment`] or [`attachments`] block.
* `attachment.filename` - the filename of the document.
* `attachment.description` - the description of the document.
* `attachment.update_references` - indicates whether the attachment
has been instructed to [`update references`].
* `attachment.redact` - is `False` if [`redact`] is set to a false value, and
`True` otherwise.
* `attachment.pdfa` - indicates whether the attachment has been
instructed to produce a [PDF/A file].
* `attachment.tagged` - indicates whether the attachment has been
instructed to produce a [tagged PDF].

## <a name="user_info"></a>user_info()

Expand Down Expand Up @@ -8944,3 +8959,7 @@ Note that you should only attach a `daPageLoad` listener from a
[`allow registration`]: {{ site.baseurl }}/docs/config.html#allow registration
[`/api/user_invite`]: {{ site.baseurl }}/docs/api.html#user_invite
[`noun_singular()`]: #noun_singular
[`redact`]: {{ site.baseurl }}/docs/documents.html#redact
[`update references`]: {{ site.baseurl }}/docs/documents.html#update references
[PDF/A file]: {{ site.baseurl }}/docs/documents.html#pdfa
[tagged PDF]: {{ site.baseurl }}/docs/documents.html#tagged pdf
30 changes: 15 additions & 15 deletions _docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -911,24 +911,24 @@ Directory service.
* Set the Name to the name you want to use for your application. This
is the name that your users will see when they are prompted by Azure
to give their consent to logging in with Azure.
* Set the Sign-on URL to the URL for your site's login page. If your
hostname is `docassemble.example.com`, then the URL will be
`https://docassemble.example.com/user/sign-in` (unless you have set
a non-standard [`root`]).
* Create the Registered App and then open it.
* Find the Application ID. You need to set this value as the `id` in
the [`oauth`] configuration, under `azure`.
* Go into Reply URLs and add an additional Reply URL for
* Under "Overview," find the "Application (client) ID." You need to
set this value as the `id` in the **docassemble** [`oauth`]
configuration, under `azure`.
* Go into Authentication and add a "Platform." Choose "Web" as the
"platform" type.
* Set the Redirect URI to
`https://docassemble.example.com/callback/azure`, or whatever the URL
for `/callback/azure` is on your site.
* Go into Keys and create a new key. The "Key description" can be
`docassemble` or some other name of your choosing. The duration can
be anything you want, but note that if the duration expires, you
will need to edit this configuration if you want users to still be
able to log in with Azure.
* Press save. Then copy the value of the key you just created. You
need to set this value as the `secret` in the [`oauth`] configuration,
under `azure`.
* Leave other settings of the "platform" at the default values.
* Go into Certificates & Secrets and create a new "client secret."
The "Description" can be `docassemble` or some other name of your
choosing. The expiration setting can be anything you want, but note
that if the key expires, you will need to edit this configuration if
you want users to still be able to log in with Azure.
* Press Add. Then make a note of the "value" of the key you just
created. You need to set these value as
the `secret` in the [`oauth`] configuration, under `azure`.
* Go into Required permissions and click Add.
* Add "Microsoft Graph" as one of the APIs.
* Under "delegated permissions," select the following:
Expand Down
10 changes: 5 additions & 5 deletions _docs/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -3460,8 +3460,8 @@ your bearer token.
{% highlight yaml %}
objects:
- web: |
DAWeb.using(base_url='https://api.example.com',
auth={'type': 'bearer',
DAWeb.using(base_url='https://api.example.com',
auth={'type': 'bearer',
'token': 'uweoDS0iBfirGwesB.8d29230fa55b5c5deb2f87a82b3f6d2f4ab25c2b7e34b563d3b8fb84532c254b'})
{% endhighlight %}

Expand Down Expand Up @@ -7013,9 +7013,9 @@ called from the [`init()`] method of each class after the call to
### <a name="sqlobject class methods"></a>Class methods

<a name="SQLObject.by_id"></a>If you have the `id` of a [SQL] record
and you want to obtain a [Python] object corresponding to that ID,
you can call the `by_id()` class method. If your class name is `Customer`,
and the id is `customer_id`, you would call `Customer.by_id(customer_id)`,
and you want to obtain a [Python] object corresponding to that ID,
you can call the `by_id()` class method. If your class name is `Customer`,
and the id is `customer_id`, you would call `Customer.by_id(customer_id)`,
and the result would be a `Customer` object. If an object for this `id`
is already present in the interview answers, that object will be
returned. If the object does not already exist, a new object will be
Expand Down
15 changes: 13 additions & 2 deletions _docs/playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,19 @@ Packages are defined with the following elements:
software can be found.
* **Dependencies**: From the list of Python [packages] installed on
the system, indicate the ones that are required for your package to
operate. When your package is installed on another system, these
packages will be installed first.
operate. When your package is installed on another system, these
packages will be installed first. When **docassemble** creates your
package, it will include within the package a `setup.py` file that
defines basic information about the package, including which other
Python packages are dependencies. You can see what these
dependencies are by inspecting the `setup.py` file and looking for
the `install_requires` list. Note that the assumption is that the
dependency packages are available on PyPI, the Python Package
Index. If you have a dependency package that you installed on your
system using a ZIP file or a GitHub URL, the `setup.py` file will
nevertheless assume that the package is available on PyPI. If you
need your `setup.py` to pull a dependency from GitHub, you will need
to edit it manually.
* **Interview files**: From the [interview files] defined in your
Playground, indicate which ones should be included in your package.
* **Template files**: From the [template files] defined in your
Expand Down
Loading

0 comments on commit 1da9bad

Please sign in to comment.