Skip to content

Conversation

Gr1N
Copy link
Contributor

@Gr1N Gr1N commented Apr 23, 2018

No description provided.

@codecov
Copy link

codecov bot commented Apr 23, 2018

Codecov Report

Merging #163 into master will not change coverage.
The diff coverage is 100%.

@@          Coverage Diff          @@
##           master   #163   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines         910    918    +8     
  Branches      202    204    +2     
=====================================
+ Hits          910    918    +8

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Please can you:

  • update HISTORY.rst
  • update docs
  • add a strip_whitespace option to Config

@Gr1N
Copy link
Contributor Author

Gr1N commented Apr 24, 2018

@samuelcolvin updated, please check

HISTORY.rst Outdated
@@ -7,6 +7,7 @@ v0.8.1 (2018-XX-XX)
...................
* tweak email-validator import error message #145
* fix parse error of parse_date() and parse_datetime() when input is 0 #144
* **breaking change**: add ``Config.anystr_strip_whitespace`` and ``strip_whitespace`` kwarg to ``constr``, by default values is `True` #163
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe best to make this False by default an avoid a breaking change.

Since this is easy for people to change and reuse that change throughout their projects I think it would be better to avoid the unnecessary breaking change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my experience we always need to strip any string data during validation except passwords or tokens. Also many validation libraries use strip logic enabled by default. But you are the owner and I will do what you prefer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use False by default, it's better for now. At first we will introduce to people new settings to control strip logic and maybe be in future we will switch to True.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, makes sense. This would require a patch release anyway, so let's just go with this.

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just waiting for tests to pass.

@samuelcolvin samuelcolvin merged commit f88e592 into pydantic:master Apr 24, 2018
@samuelcolvin
Copy link
Member

Thanks a lot, I'll try and merge a couple of other PRs which are finished and deploy in the next couple of days.

@Gr1N Gr1N deleted the string-strip branch April 24, 2018 19:30
@Gr1N Gr1N mentioned this pull request Apr 24, 2018
@Gr1N
Copy link
Contributor Author

Gr1N commented Apr 24, 2018

And I will try to implement more things from #161 😃

alexdrydew pushed a commit to alexdrydew/pydantic that referenced this pull request Dec 23, 2023
* feat: add `default_factory`

* we will not deepcopy default values

* error message for bad default factory

* bad default_factory should not raise ValidationError

* tiny cleanup

Co-authored-by: Samuel Colvin <s@muelcolvin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants