summaryrefslogtreecommitdiff
path: root/passlib/utils
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2011-03-21 19:54:55 -0400
committerEli Collins <elic@assurancetechnologies.com>2011-03-21 19:54:55 -0400
commitf6c3fb3c0878cc74a4467828418ffb3ccd0082b2 (patch)
tree855db1dae542695bd3a57c9a43860467a3ebfe77 /passlib/utils
parenta8bd4647cabe847ee728944428962e947c6df7bd (diff)
downloadpasslib-f6c3fb3c0878cc74a4467828418ffb3ccd0082b2.tar.gz
cleaned up registry code, added more UTs.
Diffstat (limited to 'passlib/utils')
-rw-r--r--passlib/utils/__init__.py21
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