Merge lp://staging/~cjwatson/storm/clarify-no-allow-none-default-none-exception into lp://staging/storm

Proposed by Colin Watson
Status: Merged
Merged at revision: 576
Proposed branch: lp://staging/~cjwatson/storm/clarify-no-allow-none-default-none-exception
Merge into: lp://staging/storm
Diff against target: 168 lines (+64/-16)
6 files modified
NEWS (+6/-0)
storm/cextensions.c (+9/-0)
storm/tests/mocker.py (+4/-0)
storm/tests/properties.py (+8/-0)
storm/tests/variables.py (+30/-13)
storm/variables.py (+7/-3)
To merge this branch: bzr merge lp://staging/~cjwatson/storm/clarify-no-allow-none-default-none-exception
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+416974@code.staging.launchpad.net

Commit message

Clarify exception for a property with allow_none=False and default=None.

Description of the change

Creating a property with `allow_none=False, default=None` doesn't make sense, but it's sometimes easy to set things up that way by accident during refactoring. Storm immediately raises `NoneError` when creating the variable in that case. However, it's not obvious that the exception is due to the bad default, and I spent some time with a colleague today debugging a situation that turned out to be due to this.

Change the exception message from "None isn't acceptable as a value" to "None isn't acceptable as a default value" in this case, to clue future travellers into the fact that the problem relates to the default.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches

to status/vote changes: