Beispiel #1
0
 def save(self, *args, **kwargs):
     if len(self.bytes_signature) == 0 or len(self.hex_signature) == 0:
         self.bytes_signature = event_signature_to_log_topic(
             self.text_signature)
         self.hex_signature = force_text(
             remove_0x_prefix(encode_hex(self.bytes_signature)))
     return super(EventSignature, self).save()
    def filter_hex_signature(self, name, qs, value):
        unprefixed_value = remove_0x_prefix(value.lower())

        if len(unprefixed_value) == 64:
            return qs.filter(hex_signature=unprefixed_value)
        else:
            return qs.filter(hex_signature__icontains=unprefixed_value)
 def save(self, *args, **kwargs):
     if self.bytes_signature_id is None:
         bytes4_signature = make_4byte_signature(self.text_signature)
         hex_signature = force_text(remove_0x_prefix(encode_hex(bytes4_signature)))
         self.bytes_signature, _ = BytesSignature.objects.get_or_create(
             bytes4_signature=bytes4_signature,
             defaults={'hex_signature': hex_signature},
         )
     return super(Signature, self).save()
 def save(self, *args, **kwargs):
     if self.bytes_signature_id is None:
         bytes4_signature = make_4byte_signature(self.text_signature)
         hex_signature = force_text(remove_0x_prefix(encode_hex(bytes4_signature)))
         self.bytes_signature, _ = BytesSignature.objects.get_or_create(
             bytes4_signature=bytes4_signature,
             defaults={'hex_signature': hex_signature},
         )
     return super(Signature, self).save()
    def get_queryset(self):
        queryset = super(EventSignatureListView, self).get_queryset()

        if self.request.GET.get('bytes_signature'):
            hex_signature = self.request.GET['bytes_signature']
            unprefixed_hex_signature = remove_0x_prefix(hex_signature.lower())

            if len(unprefixed_hex_signature) == 64:
                return queryset.filter(
                    hex_signature=unprefixed_hex_signature, )
            else:
                return queryset.filter(
                    hex_signature__icontains=unprefixed_hex_signature,  # NOQA
                )
        return queryset
 def save(self, *args, **kwargs):
     if not self.hex_signature:
         self.hex_signature = force_text(remove_0x_prefix(encode_hex(self.bytes4_signature)))
     super(BytesSignature, self).save(*args, **kwargs)
Beispiel #7
0
 def save(self, *args, **kwargs):
     if not self.hex_signature:
         self.hex_signature = force_text(
             remove_0x_prefix(encode_hex(self.bytes4_signature)))
     super(BytesSignature, self).save(*args, **kwargs)