> From: Maxi Sbrocca
>To: dkuhl...@rexx.com
>Sent: Friday, November 23, 2012 7:46 AM
>Subject: generateDS question.
> 

> Hello Dave,
> 
> My name is Maxi and I'm from Argentina. Sorry for this direct
> contact, but I need a special info.
> 
> I'm using your python lib generateDS. I generated the complete
> object model for MS OFFICE PPTX files (according the ECMA-376
> standard:
> http://www.ecma-international.org/publications/standards/Ecma-376.htm).
> Actually, I didn't check it, bu I got something. The problem is that
> the entire model was generated in a simple py file of 81200 code
> lines.
> 
> My question is if exist any param I can send to the lib to specify
> that I want several py files for each class?
> 
> I'll really appreciate your help.  Thanks in advance,

Maxi -

Hello.  Good to hear from you.

There is no command line option in generateDS.py for splitting the
output file into separate Python modules.  However, it would
reasonably easy to implement a Python script that does something
like that.

OK.  Possibly that would be of use to other generateDS.py users as
well.  So, I've implemented a script that does something like this.
The attached script reads in a file generated with the -o
command line option and writes out a separate Python module for each
data representation class.  It also allows you to specify a target
directory.  For help, type:

$ python split_classes.py -h

You will likely have to modify the script for your purposes.  In
particular, possibly change the value of variables Pre_template and
Post_template to insert any boiler-plate you wish at the top and the
bottom of each output module.

The current value of Pre_template imports header_mod.py (also
attached), which contains needed definitions from the top of a
generated module.  You will need to copy header_mod.py to the same
directory as the split-up modules before you use them (or maybe
somewhere on your PYTHONPATH will do).

There is still a problem that I have not solved, however.  Whenever
the definition of element B extends the definition of element A,
generateDS.py generates a subclass B whose superclass is class A.
That will produce an undefined error when you try to import the
module that defines that subclass.

No wait.  I've solved that.  The module that contains the subclass
now imports the module that contains the superclass.

By the way, why is it that you need this?  Couldn't you just import
the specific classes that you need by doing:

from generated_module import one_important_class

Just wondering.

Hope this might be of some help.

- Dave




--


Dave Kuhlman
http://www.rexx.com/~dkuhlman

Attachment: split_gds_classes.py
Description: Binary data

Attachment: header_mod.py
Description: Binary data

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to