Washers

Washing utilities.

invenio_utils.washers.wash_html_id(dirty)

Strip non-alphabetic or newline characters from a given string.

It can be used as a HTML element ID (also with jQuery and in all browsers).

Parameters:dirty – the string to wash
Returns:the HTML ID ready string
invenio_utils.washers.wash_urlargd(form, content)

Wash the complete form based on the specification in content.

Content is a dictionary containing the field names as a key, and a tuple (type, default) as value.

‘type’ can be list, unicode, legacy.wsgi.utils.StringField, int, tuple, or legacy.wsgi.utils.Field (for file uploads).

The specification automatically includes the ‘ln’ field, which is common to all queries.

Arguments that are not defined in ‘content’ are discarded.

Note

In case list or tuple were asked for, we assume that list or tuple of strings is to be returned. Therefore beware when you want to use wash_urlargd() for multiple file upload forms.

Returns:argd dictionary that can be used for passing function parameters by keywords.