[Zope] URL encoding in a python script?
Petter Enholm
Petter Enholm" <pe@snapper.no
Tue, 19 Mar 2002 16:55:15 +0100
This is a multi-part message in MIME format.
------=_NextPart_000_005B_01C1CF66.D796E990
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
URL encoding in a python script?
The urllib is not available in Python Scripts due to security reasons.
I have added
allow_module('urllib')
in my __init__.py file under lib/python/Products/PythonScripts
Restart zope and you can now start using urllib.
---
This following text is taken from the module_access_examples.py file in =
the PythonScripts directory:
-- cut cut --
This file contains example code that can be used to make various
standard Python modules available to Scripts.
In order to use the example code, create a directory called
"MyScriptModules", or something equally descriptive, in your
Zope's "Products" directory. Copy this file to a file called
"__init__.py" in the new directory. Edit the new file,
uncommenting the block of code for each module that you want to
make available for import by Scripts.
You can, of course, add your own code to your "__init__.py" for
modules that are not listed below. The list is not comprehensive,
but is provided as a decent cross-section of modules.
-- cut cut --
Best regards
Petter Enholm
----- Original Message -----=20
From: Etienne Labuschagne=20
To: Zope User List (E-mail)=20
Sent: Tuesday, March 19, 2002 12:55 PM
Subject: [Zope] URL encoding in a python script?
Is there an equivalent to urllib.urlencode for Python scripts?=20
I tried to import urllib and then use the above, but no luck. Am I =
missing something obvious?=20
Thanks=20
Etienne=20
------=_NextPart_000_005B_01C1CF66.D796E990
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>URL encoding in a python script?</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2713.1100" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>The urllib is not available in Python =
Scripts due=20
to security reasons.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT><FONT=20
face=3DArial size=3D2></FONT><FONT face=3DArial size=3D2>I have =
added</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><BR>allow_module('urllib')</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>in my __init__.py file under=20
lib/python/Products/PythonScripts</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Restart zope and you can now start =
using=20
urllib.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>---</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> </DIV>
<DIV>This following text is taken from the module_access_examples.py =
file in the=20
PythonScripts directory:</DIV>
<DIV> </DIV>
<DIV>
<DIV>-- cut cut --</DIV>
<DIV> </DIV>
<DIV> </DIV>This file contains example code that can be used to =
make=20
various<BR>standard Python modules available to Scripts.</DIV>
<DIV> </DIV>
<DIV>In order to use the example code, create a directory=20
called<BR>"MyScriptModules", or something equally descriptive, in =
your<BR>Zope's=20
"Products" directory. Copy this file to a file =
called<BR>"__init__.py" in=20
the new directory. Edit the new file,<BR>uncommenting the block of =
code=20
for each module that you want to<BR>make available for import by =
Scripts.</DIV>
<DIV> </DIV>
<DIV>You can, of course, add your own code to your "__init__.py" =
for<BR>modules=20
that are not listed below. The list is not comprehensive,<BR>but =
is=20
provided as a decent cross-section of modules.</DIV>
<DIV> </DIV>
<DIV>-- cut cut --</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Best regards</DIV>
<DIV> </DIV>
<DIV>Petter Enholm</DIV>
<DIV> </DIV>
<DIV></FONT> </DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV=20
style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: =
black"><B>From:</B>=20
<A title=3DELabuschagne@gims.com =
href=3D"mailto:ELabuschagne@gims.com">Etienne=20
Labuschagne</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>To:</B> <A title=3Dzope@zope.org=20
href=3D"mailto:zope@zope.org">Zope User List (E-mail)</A> </DIV>
<DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Tuesday, March 19, 2002 =
12:55=20
PM</DIV>
<DIV style=3D"FONT: 10pt arial"><B>Subject:</B> [Zope] URL encoding in =
a python=20
script?</DIV>
<DIV><BR></DIV>
<P><FONT face=3DArial size=3D2>Is there an equivalent to =
urllib.urlencode for=20
Python scripts?</FONT> </P>
<P><FONT face=3DArial size=3D2>I tried to import urllib and then use =
the above,=20
but no luck. Am I missing something obvious?</FONT> </P>
<P><FONT face=3DArial size=3D2>Thanks</FONT> <BR><FONT face=3DArial=20
size=3D2>Etienne</FONT> </P></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_005B_01C1CF66.D796E990--