From 52b3c3b27022bcf4e99888042d2c95a8f43e583c Mon Sep 17 00:00:00 2001
From: Jean-Paul Smets <jp@nexedi.com>
Date: Sun, 31 Dec 2006 16:05:07 +0000
Subject: [PATCH] Patch to support webdav on folderish files.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11812 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/ZopePatch.py              |  1 +
 product/ERP5Type/patches/PropertySheets.py | 28 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 product/ERP5Type/patches/PropertySheets.py

diff --git a/product/ERP5Type/ZopePatch.py b/product/ERP5Type/ZopePatch.py
index 646e6e696e..8bd8456e8c 100644
--- a/product/ERP5Type/ZopePatch.py
+++ b/product/ERP5Type/ZopePatch.py
@@ -42,6 +42,7 @@ from Products.ERP5Type.patches import CookieCrumbler
 from Products.ERP5Type.patches import Localizer
 from Products.ERP5Type.patches import CMFMailIn
 from Products.ERP5Type.patches import CMFCoreUtils
+from Products.ERP5Type.patches import PropertySheets
 
 # These symbols are required for backward compatibility
 from Products.ERP5Type.patches.PropertyManager import ERP5PropertyManager
diff --git a/product/ERP5Type/patches/PropertySheets.py b/product/ERP5Type/patches/PropertySheets.py
new file mode 100644
index 0000000000..2784adf284
--- /dev/null
+++ b/product/ERP5Type/patches/PropertySheets.py
@@ -0,0 +1,28 @@
+##############################################################################
+#
+# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002,2005 Nexedi SARL and Contributors. All Rights Reserved.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+#
+##############################################################################
+
+from OFS.PropertySheets import DAVProperties, isDavCollection
+from Acquisition import aq_base
+
+# This is required to make an ERP5 Document (folderish) look like a file (non folderish)
+def DAVProperties_dav__resourcetype(self):
+    vself = self.v_self()
+    if getattr(vself, 'isDocument', None): return '' # This is the patch
+    if (isDavCollection(vself) or
+        getattr(aq_base(vself), 'isAnObjectManager', None)):
+        return '<n:collection/>'
+    return ''
+
+DAVProperties.dav__resourcetype = DAVProperties_dav__resourcetype
\ No newline at end of file
-- 
2.30.9