Skip to content

Commit

Permalink
raise_undefined_attribute_error method of DAObject
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpyle committed Dec 7, 2024
1 parent b176bca commit 1c58673
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ layout: docs
title: Change Log
short_title: Change Log
---
## [1.6.1](https://github.com/jhpyle/docassemble/releases/tag/v1.6.1) - 2024-12-07


### Fixed
- Rendering issue with radio buttons and checkboxes on Safari.

## [1.6.0](https://github.com/jhpyle/docassemble/releases/tag/v1.6.0) - 2024-11-30


Expand Down
27 changes: 27 additions & 0 deletions _docs/objects.md
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,33 @@ client.getattr_fresh('total_income')
This should only be used on attributes that are defined by `code`
blocks.

<a name="DAObject.raise_undefined_attribute_error"></a>The
`raise_undefined_attribute_error()` method raises the same type of
exception that a `DAObject` raises when the interview logic requires a
definition of an object attribute that is undefined.

This can be useful when you are using the `@property` decorator to
implement getter/setter methods.

{% highlight python %}
from docassemble.base.util import DAObject

__all__ = ['MyObject']

class MyObject(DAObject):

@property
def foo(self):
if not hasattr(self, '_foo'):
self.raise_undefined_attribute_error('foo')
return self._foo

@foo.setter
def foo(self, val):
self._foo = val

{% endhighlight %}

### <a name="DAObjectlang"></a>Language methods

<a name="DAObject.possessive"></a>The `possessive()` method is a
Expand Down

0 comments on commit 1c58673

Please sign in to comment.