[Zope-Checkins] CVS: Zope2 - content_types.py:1.13.56.1
andreas@serenade.digicool.com
andreas@serenade.digicool.com
Tue, 17 Apr 2001 17:07:49 -0400
Update of /cvs-repository/Zope2/lib/python/OFS
In directory serenade.digicool.com:/tmp/cvs-serv26820/OFS
Modified Files:
Tag: ajung-2_4-ts_regex-exterminiation-branch
content_types.py
Log Message:
ts_regex/regex free zone
--- Updated File content_types.py in package Zope2 --
--- content_types.py 2000/12/12 16:03:50 1.13
+++ content_types.py 2001/04/17 21:07:48 1.13.56.1
@@ -86,10 +86,10 @@
__version__='$Revision$'[11:-2]
from string import split, strip, lower, find
-import ts_regex, mimetypes
+import re, mimetypes
-find_binary=ts_regex.compile('[\0-\7]').search
+find_binary=re.compile('[\0-\7]').search
def text_type(s):
# Yuk. See if we can figure out the type by content.
@@ -151,7 +151,7 @@
type, enc=mimetypes.guess_type(name)
if type is None:
if body:
- if find_binary(body) >= 0:
+ if find_binary(body) is not None:
type=default or 'application/octet-stream'
else:
type=(default or text_type(body)