Skip to content

Domain not handle None object #143

Closed
@reahaas

Description

@reahaas

validators None issue:

code:

def validator_test():
    import validators
    if validators.domain(None):
        print("None object is FQDN")
    else:
        print("None object is NOT FQDN")

error

Traceback (most recent call last):
  File "/home/vagrant/scadafence/rea-helper.py", line 49, in <module>
    main()
  File "/home/vagrant/scadafence/rea-helper.py", line 45, in main
    validator_test()
  File "/home/vagrant/scadafence/rea-helper.py", line 33, in validator_test
    if validators.domain(None):
  File "</home/vagrant/scadafence/venv/local/lib/python2.7/site-packages/decorator.pyc:decorator-gen-2>", line 2, in domain
  File "/home/vagrant/scadafence/venv/local/lib/python2.7/site-packages/validators/utils.py", line 83, in wrapper
    value = func(*args, **kwargs)
  File "/home/vagrant/scadafence/venv/local/lib/python2.7/site-packages/validators/domain.py", line 60, in domain
    return pattern.match(to_unicode(value).encode('idna').decode('ascii'))
AttributeError: 'NoneType' object has no attribute 'encode'

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixIssue: Out of scope

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy