minor CONTRIBUTION fixes (utils renaming)

This commit is contained in:
Patric Schmitz 2016-02-10 23:01:50 +01:00
parent c0cc3f3842
commit e4c8bd98cd

View File

@ -289,22 +289,22 @@ When using Qt objects, two issues must be taken care of:
* Methods of Qt objects report their status by using their return values, * Methods of Qt objects report their status by using their return values,
instead of using exceptions. instead of using exceptions.
+ +
If a function gets or returns a Qt object which If a function gets or returns a Qt object which has an `.isValid()`
has an `.isValid()` method such as `QUrl` or `QModelIndex`, there's a helper method such as `QUrl` or `QModelIndex`, there's a helper function
function `ensure_valid` in `qutebrowser.utils.qt` which should get called on `ensure_valid` in `qutebrowser.utils.qtutils` which should get called
all such objects. It will raise `qutebrowser.utils.qt.QtValueError` if the on all such objects. It will raise
value is not valid. `qutebrowser.utils.qtutils.QtValueError` if the value is not valid.
+ +
If a function returns something else on error, the return value should If a function returns something else on error, the return value should
carefully be checked. carefully be checked.
* Methods of Qt objects have certain maximum values, based on their underlying * Methods of Qt objects have certain maximum values, based on their
C++ types. underlying C++ types.
+ +
When passing a numeric parameter to a Qt function, all numbers should be When passing a numeric parameter to a Qt function, all numbers should
range-checked using `qutebrowser.utils.check_overflow`, or passing a value be range-checked using `qutebrowser.qtutils.check_overflow`, or
which is too large should be avoided by other means (e.g. by setting a maximum passing a value which is too large should be avoided by other means
value for a config object). (e.g. by setting a maximum value for a config object).
[[object-registry]] [[object-registry]]
The object registry The object registry
@ -406,9 +406,9 @@ then gets passed as the `self` parameter to the handler. The `scope` argument
selects which object registry (global, per-tab, etc.) to use. See the selects which object registry (global, per-tab, etc.) to use. See the
<<object-registry,object registry>> section for details. <<object-registry,object registry>> section for details.
There are also other arguments to customize the way the command is registered, There are also other arguments to customize the way the command is
see the class documentation for `register` in `qutebrowser.commands.utils` for registered, see the class documentation for `register` in
details. `qutebrowser.commands.cmdutils` for details.
The types of the function arguments are inferred based on their default values, The types of the function arguments are inferred based on their default values,
e.g. an argument `foo=True` will be converted to a flag `-f`/`--foo` in e.g. an argument `foo=True` will be converted to a flag `-f`/`--foo` in