diff options
Diffstat (limited to 'src/Tools/RecursiveNull.py')
-rw-r--r-- | src/Tools/RecursiveNull.py | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/Tools/RecursiveNull.py b/src/Tools/RecursiveNull.py index 4897d80..d4a0558 100644 --- a/src/Tools/RecursiveNull.py +++ b/src/Tools/RecursiveNull.py @@ -1,23 +1,29 @@ #!/usr/bin/env python -"""Nothing, but in a friendly way. Good for filling in for objects you want to +""" +Nothing, but in a friendly way. Good for filling in for objects you want to hide. If $form.f1 is a RecursiveNull object, then $form.f1.anything["you"].might("use") will resolve to the empty string. This module was contributed by Ian Bicking. """ -class RecursiveNull: - __doc__ = __doc__ # Use the module's docstring for the class's docstring. - def __getattr__(self, attr): - return self - def __getitem__(self, item): - return self - def __call__(self, *vars, **kw): - return self - def __str__(self): - return '' - def __repr__(self): - return '' - def __nonzero__(self): - return 0 +class RecursiveNull(object): + def __getattr__(self, attr): + return self + def __getitem__(self, item): + return self + def __call__(self, *args, **kwargs): + return self + def __str__(self): + return '' + def __repr__(self): + return '' + def __nonzero__(self): + return 0 + def __eq__(self, x): + if x: + return False + return True + def __ne__(self, x): + return x and True or False |