Fix the @requires_user_profile on Python 3.

Review Request #9733 — Created March 4, 2018 and submitted

chipx86
Djblets
release-2.0.x
b36638e...
djblets

The @requires_user_profile decorator only worked with unbound methods
on Python 2.x, but the concept of an unbound method is very different on
Python 3.x. Instead of being a MethodType, it's just a standard
function, meaning we can't check im_func/__func__, but rather we
need to check the function itself.

This change updates the decorator to perform the appropriate checks on
both Python 2.x and 3.x.

Unit tests using this decorator pass on Python 2.7, 3.4, 3.5, and 3.6.

brennie
  1. Ship It!
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (f2d2a60)
Loading...