[Zope-Checkins] CVS: Zope/lib/python/webdav - Resource.py:1.48.6.3 webdav_magic.py:1.1.2.3
Andreas Jung
andreas@zope.com
Mon, 5 Nov 2001 10:30:07 -0500
Update of /cvs-repository/Zope/lib/python/webdav
In directory cvs.zope.org:/tmp/cvs-serv9712
Modified Files:
Tag: ajung-webdav-debug
Resource.py webdav_magic.py
Log Message:
added check against the user agent of a webdav client
=== Zope/lib/python/webdav/Resource.py 1.48.6.2 => 1.48.6.3 ===
import webdav_magic
try:
- ob = webdav_magic.webdavCloneObject(self,name)
+ ob = webdav_magic.webdavCloneObject(self,name,REQUEST)
except TypeError:
ob=aq_base(self._getCopy(parent))
else:
=== Zope/lib/python/webdav/webdav_magic.py 1.1.2.2 => 1.1.2.3 ===
suffix_reg = re.compile('(\.[a-zA-Z]*$)')
+webdav_agents = re.compile('(GoLive)|(Dreamweaver)')
def cloneFile(ob,destId,mime_type):
@@ -103,7 +104,11 @@
return file
-def webdavCloneObject(ob,destId):
+def webdavCloneObject(ob, destId, REQUEST):
+
+ agent = REQUEST.get("HTTP_USER_AGENT")
+ if not webdav_agents.search(agent):
+ raise TypeError,'unrecognized user agent'
# determine object suffix
mo = suffix_reg.search(ob.getId())