[Pulp-list] New Okaara version: 1.0.22
Jay Dobies
jason.dobies at redhat.com
Wed Jul 18 18:32:47 UTC 2012
= Short Version =
We can't build it to v2/testing yet because of the CR candidates so
you'll have to build it yourself. You'll need it very soon since Mike is
using new APIs in this version.
To build:
cd deps/okaara
tito build --rpm
= Long Version =
There are two new arguments for Option instances:
validate_func takes a function that will be applied by okaara if the
user specifies that option. The supplied function should take a single
argument (which will be the user-specified value) and if it's valid, the
function should do nothing. If it's invalid, it should raise either
ValueError or TypeError.
parse_func is similar except the provided function should return a
value. The value will replace the user-specified value and be made
available to the command when it's executed. That has the same behavior
with ValueError and TypeError which means you can use it as the uber
function and not have to split the validate and parse into two calls.
Mike brought up that the signature and use of standard exceptions (his
suggestion) lets us pass in a number of standard calls, for instance:
parse_func=int
parse_func=json.loads
parse_func=dateutils.parse_iso8601_date
If one of those two exceptions is raised, okaara will catch it and print
a user-friendly indication of which argument failed validation and
args[0] of the exception for more detail as to why.
Ping me or Mike with any questions.
--
Jay Dobies
Freenode: jdob @ #pulp
http://pulpproject.org | http://blog.pulpproject.org
More information about the Pulp-list
mailing list