Yes, I have quite a few ideas to make the Python toolkit better.
Unfortunately, toolkits are really hamstrung by the design of XMLSERVICE.
You can see some of what I wanted to in this work in progress branch here:
[1]https://bitbucket.org/litmis/python-itoolkit/branch/itoolkit2-wip

A lot of the changes were stuff I was working and working on and was just
sitting around on my laptop and I wanted to get them somewhere just so
they weren't lost and just committed everything. Unfortunately, I don't
have much for documentation about my design goals in there. Some of them,
I opened as issues on the toolkit repo.

One of the biggest issues is that the XML parsing is all generic. This
made it really easy to write, but makes using it a pain. For instance CL
commands with output parameters returns an array of 1 key/value pair
(python dictionary).

eg. Calling "RTVJOBA USRLIBL(?) SYSLIBL(?) CCSID(?N) OUTQ(?)" would return

[ { "USRLIBL": "KADLER" }, { "SYSLIBL": "QSYS" }, { "CCSID": 37 }, {
"OUTQ": "MYOUTQ" } ]

instead of just

[ "KADLER", "QSYS", 37, "MYOUTQ" ]

or

{ "USRLIBL": "KADLER", "SYSLIBL": "QSYS", "CCSID": 37, "OUTQ": "MYOUTQ" }

Why does it return it as an array of individual key/value pairs? Because
that's how XMLSERVICE returns it:

<cmd>
<row><data desc='USRLIBL'>KADLER</data></row>
<row><data desc='SYSLIBL'>QSYS</data></row>
<row><data desc='CCSID'>37</data></row>
<row><data desc='OUTQ'>MYOUTQ</data></row>
</cmd>

I have no idea why XMLSERVICE doesn't just return it like this:
<cmd>
<data desc='USRLIBL'>KADLER</data>
<data desc='SYSLIBL'>QSYS</data>
<data desc='CCSID'>37</data>
<data desc='OUTQ'>MYOUTQ</data>
</cmd>
But it would be really easy to work around in the toolkit, if each action
did its own XML parsing, but that's not how it's structured.

Kevin Adler
Software Development - PASE, Open Source, IBM i Access ODBC
IBM Systems, Dept 47U
Phone: +1-507-253-5111
Email: kadler@xxxxxxxxxx
015-3 C117
3605 HWY 52 N
Rochester, MN 55901-1407
United States



----- Original message -----
From: John Yeung <gallium.arsenide@xxxxxxxxx>
Sent by: "OpenSource" <opensource-bounces@xxxxxxxxxxxx>
To: IBMi Open Source Roundtable <opensource@xxxxxxxxxxxx>
Cc:
Subject: Re: [IBMiOSS] How the heck do I specify a date in
python-itoolkit?
Date: Wed, Dec 19, 2018 9:50 PM

On Wed, Dec 19, 2018 at 5:24 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx>
wrote:
>
> Ranger did a fantastic job getting it running - but his coding style
is "somewhat unique" and that makes it difficult for others to
maintain/enhance it.

This is what everyone says. I certainly am getting a firsthand view of
what people mean.

> I tied to make s few changes some years ago and spent so much more
time scratching my head than coding that in the end I gave up.

I am not even going to attempt any changes to XMLSERVICE itself, but I
see the potential to make a friendlier Python wrapper than itoolkit. I
get the feeling that folks like Kevin Adler were (or maybe still are)
hoping that python-itoolkit itself could be improved, but it seems
more likely to me from my cursory forays into its code that I'll
probably write my own itoolkit helper or wrapper. Yes, it would add
yet another layer on top, but that's kind of how things go in the
Python world, and I suspect in other very-high-level language
communities like PHP, Ruby, and the like.

> With any luck in the replacement we can dump (at least optionally) the
XML aspect. It is overkill for the purpose and adds a level of
complexity.

I certainly look forward to this, but what I'm mainly concerned with
right now is "end-programmer" friendliness.

John Y.
--
This is the IBMi Open Source Roundtable (OpenSource) mailing list
To post a message email: OpenSource@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [2]https://lists.midrange.com/mailman/listinfo/opensource
or email: OpenSource-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [3]https://archive.midrange.com/opensource.

Help support midrange.com by shopping at amazon.com with our affiliate
link: [4]https://amazon.midrange.com




References

Visible links
1. https://bitbucket.org/litmis/python-itoolkit/branch/itoolkit2-wip
2. https://lists.midrange.com/mailman/listinfo/opensource
3. https://archive.midrange.com/opensource
4. https://amazon.midrange.com/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.