[Zope] Re: Changing Properties (Was: More product writing problems)
Dieter Maurer
dieter@handshake.de
Sat, 8 Dec 2001 00:07:23 +0100
Tille, Andreas writes:
> But unfortunately there seems to be another one, because
> it does not work even if I use 'value' nor if I change the code to
>
> if id == 'keywords' :
> new_value=[]
> for keyword in value:
> keyword=keyword.strip()
> if keyword != '' :
> new_value.append(keyword)
> value=new_value
> self._setPropValue(id, value)
The code looks good!
> My suspection is that something goes wrong more generally (the
> _updateProperty is just not called or the if condition might not
> be true because any strange pre/or suffixes or something else).
>
> So I'm looking for any suggestion how to debug the code efficiently.
I debug Python code in Zope with adding:
import pdb; pdb.set_trace()
When Zope executes this code, it stops and I can use
"pdb" (Python's debugger) to analyse the state and single
step. Breakpoints do not work, however.
It is also not that easy to quit the debugger again.
A colleague is using WingIDE, an IDE for Python (and other languages)
able to debug Zope applications. He is quite happy with it
(it is not free, however).
There is a HowTo on zope.org explaining how to debug Zope
applications out of [X]Emacs.
Probably "Komodo", another IDE for Python and other languages, too,
is able to debug Zope applications (not free, too).
> If I would insert any 'print' statements or something else to which
> data stream would they directed. Would it be the STUPID_LOG_FILE or
> something else or should I open a temporary file. Which is the
> method you use generally for such stuff?
No, they would go to standard output, unless you redirect them
with the ">>" operator.
Do not forget to flush your output stream when you use "print".
Otherwise, you will be astonished that your output sits in
the buffer and you wait in vain...
Dieter