Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Johannes Hoppe
    @codingjoe
    @takis I hope that does the trick for you, let me know if you have a problem
    Panagiotis H.M. Issaris
    @takis
    @codingjoe Thanks!
    Should that last bit not be: + [('CH','')]
    @codingjoe I'll try later this evening (as my customer suggested to just drop the customer :-/ so I cannot spend time on it here on location). But, I'll try and let you know if it worked. Thanks again for your time and super quick response!
    Johannes Hoppe
    @codingjoe
    No problem. Greetings from Thailand
    Panagiotis H.M. Issaris
    @takis
    Ah nice! For a holiday or for work if I may ask?
    Panagiotis H.M. Issaris
    @takis
    @codingjoe Another thing I was wondering about: What is the recommended method to migrate a CharField to a VATINField?
    I had initially tried just migrating, but this failed due to the non-standard format the VAT numbers were stored in here. The prefix were missing, and so django-vies interpreted the first two characters as a country code. I decided and have just finished writing data migrations, to convert all VAT numbers to the standard form.
    But, what if the webservice validation fails?
    Johannes Hoppe
    @codingjoe
    That doesn't need to run and I hardly advice not running it in a migration. It's too many requests. It will take forever and eventually the firewall will block you.
    To be honest this part deserves some overhauling, it should be split into two validators. I currently don't use it myself so I haven't had any interest in improving it so far. Sorry
    But for now, a data migration should be fine. Validation is only on form level anyways. If a user updates a profile and the number was wrong he should update it anyways
    Panagiotis H.M. Issaris
    @takis
    Ah, so the VIES validation does not run during such a migration by default? That's great because that's what I'd feared, that I would get blocked by sending out to many requests to the webservice.
    Oh, sorry, for asking again, I see you already answered that,
    As you said, the forms are doing the webservice validation.
    Johannes Hoppe
    @codingjoe
    Yes correct, feel free to as many questions as you like. I'm on vacation I got lots of time ;)
    Panagiotis H.M. Issaris
    @takis
    Ah thanks a lot! :-)
    Panagiotis H.M. Issaris
    @takis
    Hi @codingjoe! I'm back again with another question: The Dutch verification service seems to be down a lot, or maybe they just have a low number of request they allow in a daily timeframe. I just noticed that when saving Dutch VAT numbers, the form did not validate due to an illegal VAT number, but when I checked on the VIES website, it appeared that the service was down.
    So, I had a quick look at the source code, and noticed that in init.py at the bottom, WebFaults are being propagated upward.
    So, I noticed that the various kind of errors are not handled differently. Then I had a look at the suds source code, and looked at the fault and faultstring values in the exception.
    What's your opinion on this? Would you agree that it would be nice if in the django-vies layer there would be different handling for a failure of the service and an actual invalid vat number?
    Johannes Hoppe
    @codingjoe
    Yes, that is actually a problem, you can't send too many requests. If you have a solution I'm always open to pull request. Leave me a ticket will you? I'm currently only on my phone.
    Panagiotis H.M. Issaris
    @takis
    I looked at the logs, but couldn't find something to distinguish them up until now, but I haven't looked carefully enough though. I wanted to ask your first, just in case I overlooked something. Otherwise, I figure I will do a network trace and see what vies responds in either case to see how we might distinguish both cases.
    Great! :-) I'll have a look later today, and create a ticket for it.
    Denis
    @Godod
    Hello all. When I installed the latest version (3.0) from pip, I've found a bug. At the pip version there is no forms folder. But on github - forms folder isset. Please provide a forms folder to pip and upgrade package.
    Sorry for my bad English
    Johannes Hoppe
    @codingjoe
    ah s**t
    @Godod thanks, yes, I didn’t package it
    I’m on it
    Denis
    @Godod
    @codingjoe Thanks
    Johannes Hoppe
    @codingjoe
    released in 3.0.1
    @Godod thanks again!
    Denis
    @Godod
    @codingjoe np. And thanks to you for cool tool :clap:
    Johannes Hoppe
    @codingjoe
    @Godod you’re welcome. Be aware of the breaking changes tho. By default the new VATINField doesn’t do VIES API validation.
    I wrote a section about that into the readme file
    Denis
    @Godod
    @codingjoe Ok thanks. I've see. Can you write a CHANGELOG file to github repository? It'll be beautiful to see what change from previous update without compare commits.
    Johannes Hoppe
    @codingjoe
    hm… yeah, I shoud, but sooo lazy
    Denis
    @Godod

    @codingjoe I understand :) It seems, I've found another bug...
    I've simple model:

    from django.db import models
    from vies.models import VATINField
    
    class TestModel(models.Model):
        vat = VATINField()

    Then, a have simple ModelForm

    from django import forms
    from .models import TestModel
    
    class TestForm(forms.ModelForm):
        class Meta:
            model = TestModel
            fields = '__all__'

    And than, I've simple view:

    from django.views.generic import FormView
    from .forms import TestForm
    
    class TestView(FormView):
        template_name = 'order/test.html'
        form_class = TestForm

    And I get error (stack trace):

    Environment:
    
    
    Request Method: GET
    Request URL: http://127.0.0.1:8000/test/
    
    Django Version: 1.9.6
    Python Version: 3.5.1
    ...
    
    Template error:
    In template /home/godod/marketplace/order/templates/order/test.html, error at line 8
       'NoneType' object is not subscriptable   1 : <!DOCTYPE html>
       2 : <html lang="en">
       3 : <head>
       4 :     <meta charset="UTF-8">
       5 :     <title>Title</title>
       6 : </head>
       7 : <body>
       8 :  {{ form.as_p }} 
       9 : 
       10 : </body>
       11 : </html>
    
    Traceback:
    ...
    File "/home/godod/venv/lib/python3.5/site-packages/django/utils/html.py" in <lambda>
      390.         klass.__str__ = lambda self: mark_safe(klass_str(self))
    
    File "/home/godod/venv/lib/python3.5/site-packages/django/forms/boundfield.py" in __str__
      43.         return self.as_widget()
    
    File "/home/godod/venv/lib/python3.5/site-packages/django/forms/boundfield.py" in as_widget
      101.         return force_text(widget.render(name, self.value(), attrs=attrs))
    
    File "/home/godod/venv/lib/python3.5/site-packages/django/forms/widgets.py" in render
      832.             value = self.decompress(value)
    
    File "/home/godod/venv/lib/python3.5/site-packages/vies/forms/widgets.py" in decompress
      48.         return value[:2], value[2:]
    
    Exception Type: TypeError at /test/
    Exception Value: 'NoneType' object is not subscriptable

    Django 1.9.6. Python 3.5.1. Do you know why this error happen?

    Johannes Hoppe
    @codingjoe
    it seems to be in decompress
    lets see
    Johannes Hoppe
    @codingjoe
    found the bug, I’m working on a fix
    Denis
    @Godod
    @codingjoe Thank you
    Johannes Hoppe
    @codingjoe
    I should have released an RC ;)
    Denis
    @Godod
    ;)
    Johannes Hoppe
    @codingjoe
    @Godod codingjoe/django-vies#30
    Denis
    @Godod
    @codingjoe It seems, ok. Thank you for fix bug :clap:
    Johannes Hoppe
    @codingjoe
    released in 3.0.2
    Denis
    @Godod
    :clap:
    :sparkles:
    cancerballs
    @cancerballs

    Hi! Anyone active here? I'm trying to figure out django-vies. I'm using the example code from github

    VAT_code = VATINField(validators=[VATINValidator(verify=True, validate=True)])

    and get the error

    'str' object has no attribute 'validate'

    I wonder what the issue is.