'Initialize a PayPalNVP instance from a HttpRequest.'

def init(self, request, paypal_request, paypal_response):

    self.ipaddress = request.META.get('REMOTE_ADDR', '')
    if (hasattr(request, 'user') and request.user.is_authenticated()):
        self.user = request.user
    query_data = dict(((k, v) for (k, v) in paypal_request.iteritems() if (k not in self.RESTRICTED_FIELDS)))
    self.query = urlencode(query_data)
    self.response = urlencode(paypal_response)
    ack = paypal_response.get('ack', False)
    if (ack != 'Success'):
        if (ack == 'SuccessWithWarning'):
            self.flag_info = paypal_response.get('l_longmessage0', '')
        else:
            self.set_flag(paypal_response.get('l_longmessage0', ''), paypal_response.get('l_errorcode', ''))
