----- Original Message ----- From: "Mihamina Rakotomandimby" <[EMAIL PROTECTED]>
To: "Jonathan" <[EMAIL PROTECTED]>
Sent: Monday, December 18, 2006 1:34 PM
Subject: Python script, urllib2

I want to fetch at least the <head></head> part of an html static page
from a python script (added through the ZMI).
Here is the content of the python script:

import urllib2
print the_page

Then I get a:
"You are not allowed to access 'Request' in this context"

Ok. I remember in some ML I subscribe, I could allow some action/module
by listing the allowed actions/modules somewhere.
Unfortunately, I cant remember where/wht to do.
Would you help me?

I would recommend using urllib in an external method, not a python script.

If you want to use a python script to access the contents of a static page (static page created via the ZMI), why don't you do something like:

staticPage = context.restrictedTraverse('/path/to/the/static/page/staticPage.html')

The variable staticPage will then hold the contents of the static page and you can process it as you require.


ps. pls keep your posts on the list so that others can help and so that future generations can find/follow the thread!

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to