You are not logged in Log in Join
You are here: Home » Members » peterbe » w2f - Write To File

Log in
Name

Password

 
 

Folder icon w2f - Write To File

The script in itself is harmless but the idea of using it very useful.

Installation

Download into zope/Extensions and create a External Method object in the root with all fields filled to w2f.

Anywhere from Python Scripts or DTML you can call this to print information before it's taken away from you. In DTML is can be handy if you use DTML-call-RESPONSE.redirects and you won't be able to see variables value for example.

In python script, if you use return variable your print "variable is: ", variable won't work. Also, in Python Scripts return printed doesn't work if there is an error down the line.

Here are some examples of how you can use it:

 <dtml-let rr=getRandomX>
    <dtml-call "w2f(rr)">
    <dtml-call "RESPONSE.redirect('http://bla bla bla')">
 </dtml-let>

Or as in a Python Script:

 if name=="Peter":
     context.w2f("I am here")
     o=x
 else:
     context.w2f("Obviously not")
     o=y
 return o

In External Methods or Python Products, this is not necessary because you can use print anywhere and harmlessly read it from the stdout.

The few people I know who could be bothered to try it have found it very useful for development.

I find it very very useful too. Destructing the walls of debugging!

 Title   Type   Size   Modified   Status 
 w2f External Method module Edit object Software Release   2001-09-11 published