[Freeipa-devel] [PATCH] jderose 007 part1 of limiting param to certain contexts
Jason Gerard DeRose
jderose at redhat.com
Wed May 13 07:52:00 UTC 2009
Both Andrew and Rob have requested the ability to limit a parameter to
certain contexts (server, cli, webui, whatever).
I had started work on this a while ago (not all of it ever made it into
master), but my previous work only allowed you to specify contexts you
wanted a param active in... you couldn't instead specify contexts you
*didn't* want a param to be active in.
So this patch removes the Param.limit_to kwarg and adds Param.incude and
Param.exclude kwargs. For example:
Str('webui', include=['webui']) # Only active when in 'webui' context.
Str('client_only', exclude=['server']) # All contexts except 'server'
Only the 'include' or 'exclude' kwarg can be specified at once; if you
provide both, a ValueError is raised.
This patch also adds a new frontend.UsesParams base class with methods
implementing the filtering. This new functionality doesn't do anything
yet till I change Command and Object to subclass from UsesParams, which
will come in a separate patch.
Lastly, this patch also includes fairly extensive tests for these new
features (UsesParams is at this point tested only through doctests).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-jderose-007-part1-of-limiting-param-to-certain-contexts.patch
Type: text/x-patch
Size: 11614 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20090513/5046ccc1/attachment.bin>
More information about the Freeipa-devel
mailing list