Optimized backward relation check to do it's checking only once per portal_type
Removed extra for loops after feedback from voineali
Moved nonBackwardsRelations check to the top of the relations for
Fixed the following:
- Added same optimizations done for the backwards relations search also
  the forward relations
- Added property for portal_membership to avoid having to call it
  everytime in checkPermission
Added history entry and optimized one case for popup.py rtool call
Removed pdb added in previous changeset
Refs #13771; added necessary changes to macro.py to avoid pylint violations
Merge pull request #2 from collective/optimizations

Optimizations