[REM] idiotic _invalids attribute, as well as get_invalid_fields
[IMP] simplify handling of callable _constraint message
[ADD] mode attribute to views

Not used yet, only defined its relation to inherit_id:

not inherit_id + primary -> ok
not inherit_id + extension -> error
inherit_id + primary -> ok
inherit_id + extension -> ok
[FIX] default_view should be based on mode=primary, not on inherit_id=False
[ADD] use of explicit primary mode in read_combined
[ADD] support for primary mode in <template>

should probably validate that there's an inherit_id (?)
[REM] unused stack_result parameter
[IMP] use sorted + key instead of sort + cmp
[IMP] don't pointlessly recreate view_obj every time _views_get is called, better use of pool & data APIs
[IMP] no need to ensure an actual context if the method does not use it

just forwarding the context object does not count as using it, if callees want
a context they can ensure they've got one on their own
[IMP] use sets to check for groups/ACL

rco notes that group tests are generally intersections, if the user has *any*
group set on the object he can see/use it. This change is a literal
translation of the original semantics, which may be wrong.
[IMP] use set to collect inherit_id and inherit_option_id

Also add a few comments to note understanding of code
[IMP] dict(int: True) -> set(int)
[IMP] renamed some stuff for clarity
[ADD] application field & check during inheriting views read
[IMP] prevent changing a view from application: always to application: disabled

not sure that's actually useful, and can still go always -> enabled -> disabled...
[IMP] inherit_option_id -> application
[FIX] typos
[FIX] forgot to add primary attribute support to <template> in schema
[IMP] add some more explanations for the behavior of the mode attribute on views