Skip to content

Commit 3f0f26e

Browse files
committed
Add some inline literals and markup to docs
1 parent 936631f commit 3f0f26e

7 files changed

Lines changed: 21 additions & 17 deletions

File tree

‎docs/index.rst‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Apparently `some other guys have felt the same way`_.
1616
http://opensourcehacker.com/2011/07/07/generic-python-validation-frameworks/
1717

1818
Often I've had for example a case where I just wanted to check if given string
19-
is an email. With `validators` this use case becomes as easy as::
19+
is an email. With ``validators`` this use case becomes as easy as::
2020

2121
>>> import validators
2222

@@ -32,26 +32,26 @@ You can install ``validators`` using pip::
3232

3333
pip install validators
3434

35-
Currently validators supports Python versions 2.6, 2.7 and 3.3.
35+
Currently ``validators`` supports Python versions 2.6, 2.7 and 3.3.
3636

3737

3838
Basic validators
3939
================
4040

41-
Each validator in `validators` is a simple function that takes the value to
41+
Each validator in ``validators`` is a simple function that takes the value to
4242
validate and possibly some additional key-value arguments. Each function returns
43-
`True` when validation succeeds and ValidationFailure object when validation
44-
fails.
43+
``True`` when validation succeeds and
44+
:class:`~validators.utils.ValidationFailure` object when validation fails.
4545

46-
ValidationFailure class implements __bool__ method so you can easily check if
47-
validation failed::
46+
:class:`~validators.utils.ValidationFailure` class implements ``__bool__``
47+
method so you can easily check if validation failed::
4848

4949
if not email('some_bogus_email@@@'):
5050
# Do something here
5151
pass
5252

53-
ValidationFailure object also holds all the arguments passed to original
54-
function::
53+
:class:`~validators.utils.ValidationFailure` object also holds all the arguments
54+
passed to original function::
5555

5656
result = number_range(3, min=5)
5757
if not result:
@@ -164,4 +164,5 @@ validator
164164

165165
.. module:: validators.utils
166166

167+
.. autoclass:: ValidationFailure
167168
.. autofunction:: validator

‎validators/email.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
def email(value, whitelist=None):
2727
"""
2828
Validates an email address. This validator is based on `Django's
29-
email validator`_. Returns True on success and `:class:FailedValidation`
30-
when validation fails.
29+
email validator`_. Returns ``True`` on success and
30+
:class:`~validators.utils.ValidationFailure` when validation fails.
3131
3232
Examples::
3333

‎validators/i18n/fi.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def fi_business_id(business_id):
3333
3434
.. versionadded:: 0.4
3535
.. versionchanged:: 0.5
36-
Method renamed from finnish_business_id to fi_business_id
36+
Method renamed from ``finnish_business_id`` to ``fi_business_id``
3737
3838
:param business_id: business_id to validate
3939
"""

‎validators/mac_address.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
def mac_address(value):
1010
"""
1111
Returns whether or not given value is a valid mac address. If the value is
12-
valid mac address this function returns True, otherwise `FailedValidation`.
12+
valid mac address this function returns ``True``, otherwise
13+
:class:`~validators.utils.ValidationFailure`.
1314
1415
This validator is based on `WTForms MacAddress validator`_.
1516

‎validators/url.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def url(value, require_tld=True):
1818
---
1919
2020
Returns whether or not given value is a valid URL. If the value is
21-
valid URL this function returns True, otherwise `FailedValidation`.
21+
valid URL this function returns ``True``, otherwise
22+
:class:`~validators.utils.ValidationFailure`.
2223
2324
This validator is based on `WTForms URL validator`_.
2425

‎validators/utils.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def func_args_as_dict(func, args, kwargs):
5656
def validator(func, *args, **kwargs):
5757
"""
5858
A decorator that makes given function validator. Whenever the given
59-
function is called and returns False value this decorator returns
60-
ValidationFailure object.
59+
function is called and returns ``False`` value this decorator returns
60+
:class:`ValidationFailure` object.
6161
6262
Example::
6363

‎validators/uuid.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
def uuid(value):
1010
"""
1111
Returns whether or not given value is a valid uuid. If the value is valid
12-
uuid this function returns True, otherwise `FailedValidation`.
12+
uuid this function returns ``True``, otherwise
13+
:class:`~validators.utils.ValidationFailure`.
1314
1415
This validator is based on `WTForms UUID validator`_.
1516

0 commit comments

Comments
 (0)