Revision 836
Added by Aaron Marcuse-Kubitza about 13 years ago
lib/util.py | ||
---|---|---|
15 | 15 |
ValueError.__init__(self, str(value)+' must satisfy constraint ' |
16 | 16 |
+check_func.__name__) |
17 | 17 |
|
18 |
def cast(type_, val): |
|
19 |
'''Passes None through''' |
|
20 |
if val != None: val = type_(val) |
|
21 |
return val |
|
22 |
|
|
18 | 23 |
def is_str(val): return isinstance(val, basestring) |
19 | 24 |
|
20 | 25 |
#### Iterables |
Also available in: Unified diff
util.py: Added cast() to cast a value while passing None through