Discussion:
[FE-discuss] OneOf with deferred call on function?
Iain Duncan
2009-01-10 05:21:51 UTC
Permalink
Hi folks, I'm wanting to do the following

validator = OneOf( [ <list generated at call time> ] )

I was hoping this would work

validator = OneOf( get_valid_options )

but it doesn't. Is there something I'm missing to do the above?

Thanks
Iain
Ian Bicking
2009-01-10 05:51:01 UTC
Permalink
Post by Iain Duncan
Hi folks, I'm wanting to do the following
validator = OneOf( [ <list generated at call time> ] )
I was hoping this would work
validator = OneOf( get_valid_options )
but it doesn't. Is there something I'm missing to do the above?
Well... doesn't work. You could, I suppose, do:

class OneOfMine(OneOf):
get_valid_options = None
@property
def list(self):
return self.get_valid_options()
--
Ian Bicking : ***@colorstudy.com : http://blog.ianbicking.org
Loading...