[CalendarServer-changes] [6846] CalendarServer/trunk/txdav/base/propertystore/none.py

source_changes at macosforge.org source_changes at macosforge.org
Tue Feb 1 17:09:19 PST 2011


Revision: 6846
          http://trac.macosforge.org/projects/calendarserver/changeset/6846
Author:   wsanchez at apple.com
Date:     2011-02-01 17:09:18 -0800 (Tue, 01 Feb 2011)
Log Message:
-----------
Add none property store

Added Paths:
-----------
    CalendarServer/trunk/txdav/base/propertystore/none.py

Added: CalendarServer/trunk/txdav/base/propertystore/none.py
===================================================================
--- CalendarServer/trunk/txdav/base/propertystore/none.py	                        (rev 0)
+++ CalendarServer/trunk/txdav/base/propertystore/none.py	2011-02-02 01:09:18 UTC (rev 6846)
@@ -0,0 +1,68 @@
+# -*- test-case-name: txdav.base.propertystore.test.test_none,txdav.caldav.datastore,txdav.carddav.datastore -*-
+##
+# Copyright (c) 2010-2011 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Always-empty property store.
+"""
+
+from __future__ import absolute_import
+
+__all__ = [
+    "PropertyStore",
+]
+
+from txdav.idav import PropertyChangeNotAllowedError
+from txdav.base.propertystore.base import AbstractPropertyStore, validKey
+
+class PropertyStore(AbstractPropertyStore):
+    """
+    Always-empty property store.
+    Writing properties is not allowed.
+    """
+    def __init__(self, defaultuser, pathFactory):
+        super(PropertyStore, self).__init__(defaultuser)
+        del self.__setitem__
+        del self.__delitem__
+
+    #
+    # Required implementations
+    #
+
+    def _getitem_uid(self, key, uid):
+        validKey(key)
+        raise KeyError(key)
+
+    def _setitem_uid(self, key, value, uid):
+        validKey(key)
+        raise PropertyChangeNotAllowedError("Property store is read-only.", (key,))
+
+    def _delitem_uid(self, key, uid):
+        validKey(key)
+        raise KeyError(key)
+
+    def _keys_uid(self, uid):
+        return ()
+
+    #
+    # I/O
+    #
+
+    def flush(self):
+        return None
+
+    def abort(self):
+        return None
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110201/b7a18b6d/attachment-0001.html>


More information about the calendarserver-changes mailing list