who needs social life when you have broadband?

Inventas vitam iuvat excoluisse per artes / Let us improve life through science and art.

PSP mod_python abort/quit/exit statement

psp.py patch: patch_psp_py.diff

Hello, there is an native handler to use PSP on Mod_python, unfortunately there is no abort statement which you can use like that:

PYTHON:
  1. req.write("one")
  2. abort/cancel/quit/exit statement
  3. # the string "two" cannot appear, cause the abort
  4. # statement causes PSP flow stop
  5. req.write("two")

So, I have made a temporary patch to add this feature in mod_python, the patch simples adds a fake exception out of the running scope and a function called "abort" (exposed to running scope of PSP), so you can apply the patch and use the feature:

PYTHON:
  1. req.write("one")
  2. abort()
  3. # the string "two" will not appear, the abort() function
  4. #(enabled after patch apply) will stop the flow of program
  5. req.write("two")

The patch is for the windows version of mod_python, but you can easy look at the diff and apply to any other version of mod_python, any suggestion or help you can contact me.

In some other post I will talk about PSP with more explanations.

psp.py patch: patch_psp_py.diff

- Christian S. Perone

1 Comment so far

  1. john nash May 3rd, 2007 9:38 am

    And don’t forget our new template :-)

Leave a reply