Mike Orr avatar Mike Orr committed 1b7bf88

Move ``NotGiven`` to webhelpers.misc.

Comments (0)

Files changed (5)

 tip (development version)
 -------------------------
 
+* webhelpers.containers / webhelpers.misc:
+
+  - ``NotGiven`` moved to webhelpers.misc.
+
 * webhelpers.html.grid / webhelpers.pylonslib.grid:
 
   - Updates by Ergo, including SQLAlchemy grid classes.

docs/modules/containers.rst

        >> d = defaultdict(int);  d[ANYTHING] += 1
 
 .. autoclass:: DumbObject
-.. autoclass:: NotGiven
 
 Functions
 ---------

docs/modules/misc.rst

 
 .. currentmodule:: webhelpers.misc
 
+.. autoclass:: NotGiven
+
 .. autofunction:: all(seq[, pred])
 .. autofunction:: any(seq[, pred])
 .. autofunction:: no(seq[, pred])

webhelpers/containers.py

 
 import sys
 
+from webhelpers.misc import NotGiven
+
 try:
     from collections import defaultdict
 except ImportError:   # Python < 2.5
             return 'defaultdict(%s, %s)' % (self.default_factory,
                                             dict.__repr__(self))
 
-class NotGiven(object):
-    """A default value for function args.
-
-    Use this when you need to distinguish between ``None`` and no value.
-    
-    Example::
-    
-        >>> def foo(arg=NotGiven):
-        ...     print arg is NotGiven
-        ...
-        >>> foo()
-        True
-        >>> foo(None)
-        False
-
-    """
-    pass
-
-
 class DumbObject(object):
     """A container for arbitrary attributes.
 

webhelpers/misc.py

     return [x for x in it if isinstance(x, class_types) and 
         issubclass(x, class_) and x not in ignore]
 
+
+class NotGiven(object):
+    """A default value for function args.
+
+    Use this when you need to distinguish between ``None`` and no value.
+    
+    Example::
+    
+        >>> def foo(arg=NotGiven):
+        ...     print arg is NotGiven
+        ...
+        >>> foo()
+        True
+        >>> foo(None)
+        False
+
+    """
+    pass
+
+
 class DeclarativeException(Exception):
     """A simpler way to define an exception with a fixed message.
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.