[Zope-dev] OFS : bas_id

Bertrand LOCQUET bertrand.locquet@noos.fr
Wed, 6 Nov 2002 23:14:45 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0015_01C285EA.4B8F01E0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Why, in standard OFS\ObjectManager.py do you reject Object Id's with % =
character ?

I've modified the 45th line of Python script
from : bad_id=3Dre.compile(r'[^a-zA-Z0-9-_~,.$\(\)# ]').search #TS
to bad_id=3Dre.compile(r'[^a-zA-Z0-9-_~,.$\(\)# ]%').search #TS

and every thing seems all-right ;-)

The advantage is that you can directly manage special character within =
the Id of object with url_quote and url_unquote. By example in your File =
Library Example, Zope will accept every file name with a little =
modification of CookId in OFS\Image.py

Thank you for telling me if is is unsure to keep % character into Ids.

Best regards

Bertrand
------=_NextPart_000_0015_01C285EA.4B8F01E0
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>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Why, in standard OFS\ObjectManager.py =
do you reject=20
Object Id's with % character ?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I've modified the 45th line of Python=20
script</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>from : </FONT><FONT face=3DArial=20
size=3D2>bad_id=3Dre.compile(r'[^a-zA-Z0-9-_~,.$\(\)# ]').search =
#TS</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>to =
bad_id=3Dre.compile(r'[^a-zA-Z0-9-_~,.$\(\)#=20
]%').search #TS</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and every thing seems all-right =
;-)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The advantage is that you can directly =
manage=20
special character within the Id of object with url_quote and =
url_unquote. By=20
example in your File Library Example, Zope will accept every file name =
with a=20
little modification of CookId in OFS\Image.py</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thank you for telling me if is is =
unsure to keep %=20
character into Ids.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Best regards</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Bertrand</FONT></DIV></BODY></HTML>

------=_NextPart_000_0015_01C285EA.4B8F01E0--