[Zope] LocalFS and 2.4.x

Michael Best mbest@emergence.com
Fri, 09 Nov 2001 16:36:01 -0700


This is a multi-part message in MIME format.
--------------7D909BD5DF0F4617C623EDE4
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Jonothan Farr wrote:
> 
> I actually copied that particular bit of code from OFS.Container. How was it fixed there? That's probably how it should be fixed in LocalFS.

Here is an updated patch with the code from
lib/python/OFS/ObjectManager.py

The only real difference from the previous patch is:

        if bad_id(id) != None:

becomes:

        if bad_id(id) is not None:

-- 
Michael Best
Systems Administrator           ph 780-413-6397 x230
Emergence By Design            fax 780-433-7548
#200, 11209 Jasper Avenue     toll 866-860-2666
Edmonton, Alberta, T5K 0L5
--------------7D909BD5DF0F4617C623EDE4
Content-Type: text/plain; charset=us-ascii;
 name="LocalFS-0.10.1.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="LocalFS-0.10.1.patch"

--- LocalFS.py  Fri Nov  9 16:26:37 2001
+++ LocalFS.py.orig     Fri Nov  9 15:57:17 2001
@@ -44,7 +44,7 @@
 
 import sys, os, string, re, stat, urllib, glob, errno, time, tempfile
 import App, Globals, Acquisition, Persistence, OFS
-import AccessControl, re
+import AccessControl, ts_regex
 from App.Extensions import getObject
 from webdav.NullResource import NullResource
 from ZPublisher.HTTPResponse import HTTPResponse
@@ -400,7 +400,7 @@
     if id == os.curdir or id == os.pardir or id[0] == '_': return 0
     return 1
     
-bad_id=re.compile('[^a-zA-Z0-9-_~,. ]').search #TS
+bad_id=ts_regex.compile('[^a-zA-Z0-9-_~,. ]').search #TS
 
 def absattr(attr):
     if callable(attr): return attr()
@@ -556,7 +556,7 @@
         # only check that the id string contains no illegal chars.
         if not id:
             raise 'Bad Request', 'No id was specified'
-        if bad_id(id) is not None:
+        if bad_id(id) != -1:
             raise 'Bad Request', (
             'The id %s contains characters illegal in filenames.' % id)
         if id[0]=='_': raise 'Bad Request', (

--------------7D909BD5DF0F4617C623EDE4--