diff options
| author | Eli Collins <elic@assurancetechnologies.com> | 2011-03-21 19:54:55 -0400 |
|---|---|---|
| committer | Eli Collins <elic@assurancetechnologies.com> | 2011-03-21 19:54:55 -0400 |
| commit | f6c3fb3c0878cc74a4467828418ffb3ccd0082b2 (patch) | |
| tree | 855db1dae542695bd3a57c9a43860467a3ebfe77 /passlib/utils | |
| parent | a8bd4647cabe847ee728944428962e947c6df7bd (diff) | |
| download | passlib-f6c3fb3c0878cc74a4467828418ffb3ccd0082b2.tar.gz | |
cleaned up registry code, added more UTs.
Diffstat (limited to 'passlib/utils')
| -rw-r--r-- | passlib/utils/__init__.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/passlib/utils/__init__.py b/passlib/utils/__init__.py index 619d492..00f27da 100644 --- a/passlib/utils/__init__.py +++ b/passlib/utils/__init__.py @@ -101,7 +101,26 @@ class classproperty(object): ## update_wrapper(wrapper, func) ## return classmethod(wrapper) -Undef = object() #singleton used as default kwd value in some functions +#NOTE: Undef is only used in *one* place now, could just remove it + +class UndefType(object): + _undef = None + + def __new__(cls): + if cls._undef is None: + cls._undef = object.__new__(cls) + return cls._undef + + def __repr__(self): + return '<Undef>' + + def __eq__(self, other): + return False + + def __ne__(self, other): + return True + +Undef = UndefType() #singleton used as default kwd value in some functions #========================================================== #protocol helpers |
