Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyObject doesn't work with None default #305

Closed
samuelcolvin opened this issue Nov 16, 2018 · 0 comments · Fixed by #306
Closed

PyObject doesn't work with None default #305

samuelcolvin opened this issue Nov 16, 2018 · 0 comments · Fixed by #306
Labels
bug V1 Bug related to Pydantic V1.X

Comments

@samuelcolvin
Copy link
Member

Bug

import pydantic

class Foo(pydantic.BaseModel):
    x: pydantic.PyObject = None
    

Foo()
~/code/pydantic/pydantic/utils.py in import_string(dotted_path)
    102     """
    103     try:
--> 104         module_path, class_name = dotted_path.strip(' ').rsplit('.', 1)
    105     except ValueError as e:
    106         raise ImportError(f'"{dotted_path}" doesn\'t look like a module path') from e

AttributeError: 'NoneType' object has no attribute 'strip'
@samuelcolvin samuelcolvin added the bug V1 Bug related to Pydantic V1.X label Nov 16, 2018
samuelcolvin added a commit that referenced this issue Nov 16, 2018
samuelcolvin added a commit that referenced this issue Nov 18, 2018
* PyObject = None, fix #305

* history formatting on pypi

* fix history rendering in setup

* allow Pattern validation, fix #303

* fix for python3.7

* fix linting

* proper processing for regex pattern errors
samuelcolvin added a commit that referenced this issue Nov 18, 2018
* PyObject = None, fix #305

* history formatting on pypi

* fix history rendering in setup

* allow Pattern validation, fix #303

* fix for python3.7

* fix linting

* proper processing for regex pattern errors
samuelcolvin added a commit that referenced this issue Nov 18, 2018
* PyObject = None, fix #305

* history formatting on pypi

* fix history rendering in setup

* allow Pattern validation, fix #303

* fix for python3.7

* fix linting

* proper processing for regex pattern errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug V1 Bug related to Pydantic V1.X
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant