MoinSupport

GeneralSupport.py

32:2bd2ac851c90
2012-11-29 Paul Boddie Added a separate function for getting the properties of individual text regions. Added an items method to the form dictionary wrapper class.
     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