MoinSupport

GeneralSupport.py

37:6659510890ac
2013-01-19 Paul Boddie Added support for page-specific item storage.
     1 # -*- coding: iso-8859-1 -*-     2 """     3     MoinMoin - GeneralSupport library     4      5     @copyright: 2008, 2009, 2010, 2011, 2012 by Paul Boddie <paul@boddie.org.uk>     6     @license: GNU GPL (v2 or later), see COPYING.txt for details.     7 """     8      9 # General utility functions.    10     11 def int_or_none(x):    12     if x is None:    13         return x    14     else:    15         return int(x)    16     17 def to_list(s, sep):    18     return [x.strip() for x in s.split(sep) if x.strip()]    19     20 def sort_none_first(x, y):    21     if x is None:    22         return -1    23     elif y is None:    24         return 1    25     else:    26         return cmp(x, y)    27     28 # vim: tabstop=4 expandtab shiftwidth=4