[Zope-dev] PythonWin/Textpad, external import of Zope module and Persistence

Johan Carlsson [Torped] johanc@torped.se
Thu, 15 Aug 2002 14:29:41 +0200


At 10:54 2002-08-15 +0100, Chris Withers wrote:
>Johan Carlsson [Torped] wrote:
>>I'm trying to setup to run with either TextPad, which can run external=20
>>program like python scripts
>>and then parse the result and making Traceback lines linked to the=20
>>line/file where the error occurred.
>
>No sure exactly what you're trying to do here, can you privde more detail?

Well, I solved "the problem" another way, when I realized that I could parse
the Stupid Log File and make traceback's clickable in that file:

I added a small python script that only gives me the latest stuff in the=
 SLF,
and it works quite nice. Now when I get an error I just press CTRL-1 inside
Textpad and I get the traceback, click on the error rows and it will=20
automatically
open the correct file and scroll to the row where the error occured.

For anyone using TextPad on Windows this should quite a time saver.
(I know that I forgot to implement a check for if the SLF has been reseted,
something my Zope start-up script does everytime I restart the server.

http://www.zope.org/Members/johanc/Tips_and_HowTos/textpad_tooltips_howto

It's almost like having a RAD tool for Zope. Well not really, but it's an=20
improvement.


It should also be possible to make a small script that takes a input file
with REQUEST information and then make the HTTP request to the development=
=20
server
and return any traceback messages from the reply to TextPad.
(SLF only shows error messages when a product is refreshed, this way it=20
should be
possible to retrieve traceback from the running code.

(Interactive debugging has to wait, but in Windows it would be terrific to=
=20
use PythonWin
for the task. But starting Zope from within PythonWin usually has the effect=
 of
PythonWin hangling. I might be because I have a really slow laptop :-)

>>Or try using Python which has an build in debugger which I like to be=20
>>able to use.
>>The first problem I encounter in both scenarios is that when a file=20
>>"import Globals"
>>which in its turn "from Persistence import Persistent", this fails.
>>Mostly because Persistence is "hot patched" by ZODB.
>>Is there any smart way to setup a "virtual Zope" environment without=20
>>importing Zope
>>(which mounts the Data.fs) or by importing Zope by in a light way without=
=20
>>mounting
>>a storage or just mounting a lights storage.
>
>'import Zope' is the only sane thing I can think you'd want to do. Zope=20
>has lots of magic that happens when you do that, and unless you do that,=20
>things won't behave as you expect.
>You will need to mount the ZODB, but if you use ZEO then this isn't a=20
>problem as your webserver can mount the same storage.

I think I have a look at how unit test does this, when I have the time. It=
=20
would probably solve my problems.
Running UnitTest from within TextPad or PythonWin would be a nice way to=20
develop thing in.
(Unfortunately I'm not up in speed with writing UnitTests)

Thanks.
Johan

>cheers,
>Chris

--=20
Torped Strategi och Kommunikation AB
Johan Carlsson
johanc@torped.se

Mail:
Birkagatan 9
SE-113 36  Stockholm
Sweden

Visit:
V=E4stmannagatan 67, Stockholm, Sweden

Phone +46-(0)8-32 31 23
Fax +46-(0)8-32 31 83
Mobil +46-(0)70-558 25 24
http://www.torped.se
http://www.easypublisher.com