def can_become_premium(f):
 @functools.wraps(f)
 def wrapper(request, addon_id, addon, *args, **kw):
  if (not addon.can_become_premium()):
   log.info(('Cannot become premium: %d' % addon.pk))
   raise PermissionDenied
  return f(request, addon_id, addon, *args, **kw)
 return wrapper

def can_become_premium ( f ) : @ functools . wraps ( f ) def wrapper ( request , addon_id , addon , * args , ** kw ) : if ( not addon . can_become_premium ( ) ) : log . info ( ( 'Cannot become premium: %d' % addon . pk ) ) raise PermissionDenied return f ( request , addon_id , addon , * args , ** kw ) return wrapper
check that the addon can become premium .