> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of
> Michal Kaukic
> Sent: Thursday, December 09, 2004 5:56 AM
> To: [EMAIL PROTECTED]; Michal Kaukic
> Subject: [Webware-discuss] Strange behaviour of string method
> "strip" in Webware servlet
>
>
> Recently I encountered an unexpected behaviour (at least for me) of
> the following code snippet I am using in Webware servlet:
>
> ...
>                 s_items=a_str.split(',')
>                 exam_date=s_items[0][-10:]
>                 exam_time=s_items[1].strip()
> ...
>
> The string a_str is something like:
>
>                 a='Exam date: 20.04.2004,  08:00, NB-403'.
>
> In Webware's Detailed.log I can see error
> (when trying to insert exam_time and other data to database),
> from which it is
> evident that
>              exam_time='  08:00', i.e. NOT stripped.
>
> The same code works perfectly from interactive interpreter.
> Moreover, changing the string method 'strip' to the builtin function
> from module 'string':
>
>              exam_time=s_items[1].strip()
>
> also helps, exam_time is '08:00' as it should be. I have no clue,
> what is going on.
>
> I am using Python 2.3.4 od Debian Sid machine. Maybe, it is Python issue?
> All thoughts leading to clarification of this situation are welcomed.
>
>                                 Mike
>

string.strip() behaves exactly the same inside Webware as it does on the
command line. Look to your data for the answer.

Is the data you are splitting and stripping in the servlet EXACTLY the same
as what you are using in the interpreter test? Is that supposed whitespace
before 08:00 actually some non-printing character that wouldn't be removed
by strip()? Or is it an HTML escape sequence (eg " ") that doesn't
appear when you copy'n'paste from a browser into another app?

Are you sure you are reading the error log correctly? Perhaps it inserts
whitespace before the value when it prints to the log?

Some suggestions, good luck debugging - Ben




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to