Changeset 4337


Ignore:
Timestamp:
23 Jun 2009, 09:56:31 (16 years ago)
Author:
uli
Message:

Add convenience type caster 'toBool' in csvfile module.

Location:
waeup/branches/ulif-rewrite/src/waeup/csvfile
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/csvfile/README.txt

    r4288 r4337  
    8484
    8585:func:`getCSVFile`
    86 ----------------------
     86------------------
    8787
    8888.. function:: getCSVFile(filepath)
     
    102102
    103103      :ref:`getcsvfiledecision`
     104
     105Helpers
     106=======
     107
     108Some helper functions provide convenience methods for handling CSV
     109data.
     110
     111:func:`toBool`
     112--------------
     113
     114.. function:: toBool(string)
     115
     116   `string`
     117      String containing some CSV data.
     118
     119   Turn a string into a boolean value.
     120
     121   If the string contains one of the values ``'true'``, ``'yes'``,
     122   ``'y'``, ``'on'`` or ``'checked'`` then ``True`` is returned,
     123   ``False`` otherwise.
     124
     125   The string can be uppercase, lowercase or mixed:
     126
     127     >>> from waeup.csvfile import toBool
     128     >>> toBool('y')
     129     True
     130
     131     >>> toBool('Yes')
     132     True
     133
     134     >>> toBool('TRUE')
     135     True
    104136
    105137Basic example
  • waeup/branches/ulif-rewrite/src/waeup/csvfile/__init__.py

    r4219 r4337  
    11# Make this a package.
    22from waeup.csvfile.csvfile import getCSVFile, CSVFile
     3from waeup.csvfile.util import toBool
Note: See TracChangeset for help on using the changeset viewer.