I’d like to learn for to use UserWarning properly. Implementations in official modules - which I took as an example - use quite different approaches, the documentation shows yet another approach.
My questions are:
It is required or recommended to define a custom sub-class of
How to form the
key)? Which values should go into the key? Quite different forms used in the code:
key = Warning.format('post no shipment', [shipment_cost]) key = '%s post no move' % landed_cost key = 'party.replace name %s %s' % (source.id, destination.id) key = 'check_request_warehouse_%s_%s_%s' % ( self.id, self.warehouse.id, request.warehouse.id) key = str(payment) # account_payment/payment.py key = Warning.format('%s:%s' % (reverse[kind], party), lines) # account_payment/account.py