[Zope-DB] How do I trim white space before inserting into database

Jeffrey Turmelle jefft@iri.columbia.edu
04 Apr 2002 18:27:59 -0500


This is probably very simple, but I am VERY new to Zope & Python!

I have a form, which calls a DTML Method for inserting names into a
database:

In the following DTML-METHOD
  checkUniqueName does a select to find out if the name already exists
  insertName inserts the name into the database.

I know that this is where I need to use strip() to strip the whitespace
for the variables (first, last, ...) but how exactly do I do this?

AddName.dtml:

<dtml-in checkUniqueName>
    <p class=byline>The following users currently exist with the name
<dtml-var last>, <dtml-var first>:<br>

    <dtml-if sequence-start>
        <p><table>
            <tr>
                <th>First</th>
                <th>Middle</th>
                <th>Last</th>
           </tr>
   </dtml-if sequence-start>
    <tr>
        <td><dtml-var first></td>
        <td><dtml-var middle></td>
        <td><dtml-var last></td>
    </tr>
    <dtml-if sequence-end>
        </table>
    </dtml-if>

<dtml-else>
    <dtml-call insertName>
    <h3><dtml-var first> <dtml-var last> was created</h3>

</dtml-in>


Thanks in advance for any guidance,

Jeff

-- 
Jeffrey Turmelle                       jefft@iri.columbia.edu
IRI - International Research Institute for Climate Prediction
207 Monell   -    61 Route 9W    -    Palisades, NY 10964 USA
Phone: 845.680.4529                         Fax: 845.680.4864