Avoid calling what is just not needed.
Shortcut security checks on ActiveWrapper and Method.

Without this, __getattr__ is executed 3 times per restricted_getattr call.
With, it's (still) called twice.
Make SQL(Queue|Dict)_getPriority use index more efficiently.

For some reason, MIN() doesn't use the index, while ORDER BY + LIMIT does.
Also, provide a more helpful error when assertion fails.