Good afternoon,
I am wondering if the ability to send keyword arguments into PyCallFunction/PyCallMethod is something being added into a future version of UV? Does anyone have any insight as to when something like this might be added?
------------------------------
Nic Davidson
Combined Transport
------------------------------
Nic,
Do you have any examples of the functionality you were seeking?
Regards
JJ
------------------------------
John Jenkins
Principal Technical Support Engineer
Rocket Software Limited
U.K.
------------------------------
Nic,
Do you have any examples of the functionality you were seeking?
Regards
JJ
------------------------------
John Jenkins
Principal Technical Support Engineer
Rocket Software Limited
U.K.
------------------------------
As JJ stated some examples of what you are looking for would help.
In the latest releases of UniData RUNPY has been enhanced so that command line arguments can now be passed and the u2py.command.run() has been enhanced to allow the returning of a result string.
Regards,
------------------------------
Jonathan Smith
UniData ATS and Principal Engineer
Rocket Software
------------------------------
Nic,
Do you have any examples of the functionality you were seeking?
Regards
JJ
------------------------------
John Jenkins
Principal Technical Support Engineer
Rocket Software Limited
U.K.
------------------------------
Apologize for not being more specific, here is an example from what I am working on now. Building an email program that pulls attachments from the filesystem, or report data from UV and sends to specified recipients.
I am currently doing something like this which works for one very specific application:
(From UV Basic)
TO = "bill@bill.com"
CC = "bob@bill.com"
SUBJECT = "Subject"
MSG.BODY = "this is the message body"
ATTACHMENT = "/home/bob/attachment.txt"
SENT = PyCallFunction("python_email_module","python_email_func", TO, CC, SUBJECT, MSG.BODY, ATTACHMENT, "", "")
def python_email_func(to_addr, cc_addrs, subject, msg_body, attachment, bcc, html):
### Do stuff and send the email
return success_code
Which is functional, but what if I want to send an email with a BCC and without a CC? or without an attachment? Currently I have to run the PyCallFunction with empty strings or Nulls in order to get it to work.
SENT = PyCallFunction("python_email_module","python_email_func", TO, "", SUBJECT, MSG.BODY, ATTACHMENT, "", "")
This makes the function more cumbersome than it needs to be. ("was Attachment path the 5th or 6th positional argument?") This also makes it really difficult to go back and add functionality later.
Normally in Python land, I could rework my function like the following:
def python_email_func(to_addr, subject, body, *args, **kwargs):
cc_addrs = kwargs.pop("CC", None)
html = kwargs.pop("html", False)
attachment_paths = kwargs.pop("ATTACHMENT", None)
### Do stuff and send the email
return success_code
Then from Basic I could do something like:
SENT = PyCallFunction("python_email_module","python_email_func", TO, SUBJECT, MSG.BODY, cc_addrs = CC, attachment_path = ATTACHMENT)
I could then call the same function and do something very different:
SENT = PyCallFunction("python_email_module","python_email_func", TO, SUBJECT, MSG.BODY, bcc_addrs = BCC, HTML=True, IMPORTANCE=URGENT)
Keywords would be useful in other contexts as well, this is just the example I have in front of me right now.
------------------------------
Nic Davidson
Combined Transport
------------------------------
Apologize for not being more specific, here is an example from what I am working on now. Building an email program that pulls attachments from the filesystem, or report data from UV and sends to specified recipients.
I am currently doing something like this which works for one very specific application:
(From UV Basic)
TO = "bill@bill.com"
CC = "bob@bill.com"
SUBJECT = "Subject"
MSG.BODY = "this is the message body"
ATTACHMENT = "/home/bob/attachment.txt"
SENT = PyCallFunction("python_email_module","python_email_func", TO, CC, SUBJECT, MSG.BODY, ATTACHMENT, "", "")
def python_email_func(to_addr, cc_addrs, subject, msg_body, attachment, bcc, html):
### Do stuff and send the email
return success_code
Which is functional, but what if I want to send an email with a BCC and without a CC? or without an attachment? Currently I have to run the PyCallFunction with empty strings or Nulls in order to get it to work.
SENT = PyCallFunction("python_email_module","python_email_func", TO, "", SUBJECT, MSG.BODY, ATTACHMENT, "", "")
This makes the function more cumbersome than it needs to be. ("was Attachment path the 5th or 6th positional argument?") This also makes it really difficult to go back and add functionality later.
Normally in Python land, I could rework my function like the following:
def python_email_func(to_addr, subject, body, *args, **kwargs):
cc_addrs = kwargs.pop("CC", None)
html = kwargs.pop("html", False)
attachment_paths = kwargs.pop("ATTACHMENT", None)
### Do stuff and send the email
return success_code
Then from Basic I could do something like:
SENT = PyCallFunction("python_email_module","python_email_func", TO, SUBJECT, MSG.BODY, cc_addrs = CC, attachment_path = ATTACHMENT)
I could then call the same function and do something very different:
SENT = PyCallFunction("python_email_module","python_email_func", TO, SUBJECT, MSG.BODY, bcc_addrs = BCC, HTML=True, IMPORTANCE=URGENT)
Keywords would be useful in other contexts as well, this is just the example I have in front of me right now.
------------------------------
Nic Davidson
Combined Transport
------------------------------
------------------------------
Michael Rajkowski
Rocket Software
------------------------------