On Wed, May 28, 2014 at 07:13:17PM +0200, Alessandro Pasotti wrote:
> Hi,
>
> I'm trying to generate Django models/forms for an xsd, Im getting
> the a.m. error with v. 2.12d
>
> This is the xsd (it is an official XSD for Italian gov. invoicing):
>
> http://www.fatturapa.gov.it/export/fatturazione/sdi/fatturapa/v1.0/fatturapa_v1.0.xsd
>
> I've renamed the xsd to comply with python module naming (removed
> the dot).
>
> I'm trying to follow step-by-step the instructions from this page:
> http://www.rexx.com/~dkuhlman/generateDS.html#id75
>
> Any idea?
>
> Full tb:
> Traceback (most recent call last):
> File "./gends_generate_django.py", line 146, in <module>
> main()
> File "./gends_generate_django.py", line 141, in main
> generate_model(options, module_name)
> File "./gends_generate_django.py", line 92, in generate_model
> cls.generate_model_(wrtmodels, wrtforms)
> AttributeError: type object 'AllegatiType' has no attribute
> 'generate_model_'
Alessandro,
Thanks for this report and the traceback.
I just now ran a test with your XML schema, after changing the
name to remove the dot (thanks for that hint). I was able to
successfully generate models.py, forms.py, and admin.py.
So, I have not yet been able to reproduce this error.
I have sent you the files I generated. See below.
One suggestion -- When you run this, we're using a special version
of class GeneratedsSuper which contains generate_model_. The file
generated by generateDS.py contains a version of that class, but
it's overridden if there is a file named generatedssuper.py on your
PYTHONPATH, and that's what we need it to do. So, make sure that
the version of generatedssuper.py that you copied from
generateDS-xx.xx/django is actually being imported. Try putting a
print statement in that file or put a syntax error in it to make
sure.
Also, I notice that the line:
cls.generate_model_(wrtmodels, wrtforms)
in file gends_generate_django.py is on a slightly different line in
my version than yours -- line 90 in my file; line 92 in yours. Is
it possible that we have a version mis-match here? I do not recall
making any changes to that file in a long time, however, it's worth
checking.
I'm using a version that is in sync with the latest at Bitbucket:
https://[email protected]/dkuhlman/generateds
In a separate message (don't want to pollute the list), I've
attached a zip file with the files I used and the resulting files
model.py, forms.py, etc. To generate them, I ran this:
$ ./gends_run_gen_django.py fatturapa_v1_0.xsd
One other thing that could be a problem -- The script
gends_run_gen_django.py finds generateDS.py on your PATH
(environment variable). It's near line 66, and I changed it to
point at a symbolic link in my current directory, as follows:
args = ('./generateDS.py', '-f',
'-o', '%s' % (bindings_file_name, ),
'--member-specs=list',
schema_file_name,
)
Is it possible that it's not finding the version of generateDS.py
that you want, and that it's an old, out-of-date version. I suppose
that piece of code could be made a bit safer, but I'm not sure how.
Please let me know if I can be of more help and if there is
something else I can do to try to reproduce that exception, or if
you have suggestions, etc.
Dave
--
Dave Kuhlman
http://www.davekuhlman.org
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
generateds-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/generateds-users