Dear Dave,

Could you please look into the below request and let us know your views on
the same when you find time?

Thanks
Sriram S

On Tue, Oct 3, 2017 at 3:58 PM, Sriram Sundar <raamssun...@gmail.com> wrote:

> Dear Dave,
>
>
>
> First of all, apologies for the very late reply.  Your patch (Version
> 2.28b) worked like a charm. It helped us fixing the float issues while
> building Django models.
>
>
>
> Following up on one of the concerns raised by us earlier, we have built a
> generic parser that converts the XML data to create Django model objects
> and load it into the DB. We do this by using the python and Django models
> generated by the generateDS library. As far now it seems to be working
> fine, but we do have few concerns with the current logic that generated the
> Django models from the XSD. They are listed below, please do validate them
> and let us know if those changes would be required in the current genDS or
> if we are handing it in an incorrect way.
>
>
>
> *Choices:*
>
>
>
> For instance, consider the below example:
>
>
>
>
>
>
>
>
> *<xs:complexType name="contact">     <xs:choice>         <xs:element
> name="home" type="xs:positiveInteger"/>         <xs:element name="office"
> type="xs:nonNegativeInteger"/>     </xs:choice> </xs:complexType>*
>
>
>
> As of now genDS creates the below equivalent class:
>
>
>
> *class contact*
>
> * (models.Model):     home = models.IntegerField()     office =
> models.IntegerField()*
>
>
>
> As per the above class structure it expects both home and office
> parameters, but it should be
>
>
>
> *class contact*
>
> * (models.Model):     home = models.IntegerField(null=True)     office =
> models.IntegerField(null=True)*
>
>
>
> Since we validate the XML against the XSD before parsing them using
> generate DS models, we could very well accept null for all the choices. In
> this way, we are already aware that either of one choice is already present
> in XML when it is validated.
>
>
>
> *Substitution:*
>
>
>
> Referring to the attached XSDs and model. Our concern with the current
> behaviour (current_model.py) is when a validated XML has an email_contact
> or a mobile_contact reference under the contact list the system would throw
> a type error while trying to parse and save the data from XML since, it
> expects only contact_type as the object reference. But as per the
> substitution in XSD the contact type of contact list can be email_contact
> object or mobile_contact object. So what we propose in the
> proposed_model.py is to use Generics in these instances. By using
> ‘ContentType’ and ‘GenericForeignKey’ we could get rid of type errors while
> parsing the XML to Django objects meanwhile handling the XSD substitution
> as well.
>
>
>
> *Null Boolean:*
>
>
>
> Current genDS handles null Boolean like below but Django throws error
> while migrating those fields:
>
>
>
> *sample_django_parameter = models.BooleanField(blank=True, null=True)*
>
>
>
> Error: “booleanFields do not accept null values.: Use a NullBooleanField
> instead.”
>
>
>
>  On correcting the above to NullBooleanField seems to work.
>
>
>
>             *sample_django_parameter = models.* *NullBooleanField
> (blank=True, null=True)*
>
>
>
> Please check and let us know your views on these concerns and once we have
> this addressed we could proceed and test our generic parser and share the
> same with you. This could save a lot of time for others who are trying to
> do the same.
>
>
>
>
>
> Thanks
>
> Sriram S
>
> On Wed, Aug 23, 2017 at 1:00 AM, Dave Kuhlman <dkuhl...@davekuhlman.org>
> wrote:
>
>> Oops.  The version number in the body of that message is wrong.  Should
>> be 2.28b.  I apologize I confused anyone.
>>
>> Dave
>>
>>
>> On Tue, Aug 22, 2017 at 01:49:18PM -0700, Dave Kuhlman wrote:
>> > There is a new version of generateDS.py -- version 2.27a.
>> >
>> > This release contains several changes for the generation of Django
>> > models and forms, in particular, (1) a fix for generation of floats and
>> > (2) the addition of the ability to suppress the generation of model and
>> > form class name suffixes ("_model" and "_form").  Thanks to Sriram
>> > Sundar for reporting and suggesting those.
>> >
>> > See the notes below from the README for more details.
>> >
>> > You can find it here:
>> >
>> > - Python Package Index -- http://pypi.python.org/pypi/generateDS/
>> > - Source Forge -- http://sourceforge.net/projects/generateds/
>> > - Bitbucket -- For those of you who prefer using Mercurial, there is
>> >   also a Mercurial repository at Bitbucket:
>> >   https://bitbucket.org/dkuhlman/generateds
>> >
>> > If you have comments, suggestions, or problems, please send them
>> > along.  The email list is here:
>> > https://lists.sourceforge.net/lists/listinfo/generateds-users
>> >
>> > Dave
>> >
>> > # =========================================================
>> >
>> > Version 2.28b (08/22/2017)
>> >
>> > - Fix for Django models and forms generation -- "float" data type
>> >   was being mapped and was not treated as a simple data type.
>> >   Thanks to Sriram Sundar for catching and reporting this.
>> > - Sriram also requested that in the Django models and forms
>> >   generation, we be able to omit the "_model" and "_form" suffix on
>> >   generated class names.  There is now a "--no-class-suffixes"
>> >   command line option accepted by both gends_run_gen_django.py
>> >   and gends_generate_django.py to do that.  Thanks to Sriram for
>> >   this suggestion.
>> > - Added Python version to the information in the comments at the top
>> >   of generated modules.
>> >
>> > # =========================================================
>> >
>> > --
>> >
>> > Dave Kuhlman
>> > http://www.davekuhlman.org
>> >
>> > ------------------------------------------------------------
>> ------------------
>> > Check out the vibrant tech community on one of the world's most
>> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> > _______________________________________________
>> > generateds-users mailing list
>> > generateds-users@lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/generateds-users
>>
>> --
>>
>> Dave Kuhlman
>> http://www.davekuhlman.org
>>
>> ------------------------------------------------------------
>> ------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> generateds-users mailing list
>> generateds-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/generateds-users
>>
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to