[Checkins] SVN: mongopersist/trunk/ Feature: Added an interface for the ``MongoContainer`` class describing the

Stephan Richter srichter at gmail.com
Fri Jan 13 20:21:34 UTC 2012


Log message for revision 124037:
  Feature: Added an interface for the ``MongoContainer`` class describing the
  additional attributes and methods.
  
  Get ready for release.
  
  

Changed:
  U   mongopersist/trunk/CHANGES.txt
  U   mongopersist/trunk/setup.py
  U   mongopersist/trunk/src/mongopersist/zope/container.py
  A   mongopersist/trunk/src/mongopersist/zope/interfaces.py

-=-
Modified: mongopersist/trunk/CHANGES.txt
===================================================================
--- mongopersist/trunk/CHANGES.txt	2012-01-13 07:21:46 UTC (rev 124036)
+++ mongopersist/trunk/CHANGES.txt	2012-01-13 20:21:34 UTC (rev 124037)
@@ -2,10 +2,11 @@
 CHANGES
 =======
 
-0.5.2 (unreleased)
+0.5.2 (2012-01-13)
 ------------------
 
-- ...
+- Feature: Added an interface for the ``MongoContainer`` class describing the
+  additional attributes and methods.
 
 0.5.1 (2011-12-22)
 ------------------

Modified: mongopersist/trunk/setup.py
===================================================================
--- mongopersist/trunk/setup.py	2012-01-13 07:21:46 UTC (rev 124036)
+++ mongopersist/trunk/setup.py	2012-01-13 20:21:34 UTC (rev 124037)
@@ -9,7 +9,7 @@
 
 setup (
     name='mongopersist',
-    version='0.5.2dev',
+    version='0.5.2',
     author = "Stephan Richter",
     author_email = "stephan.richter at gmail.com",
     description = "Mongo Persistence Backend",

Modified: mongopersist/trunk/src/mongopersist/zope/container.py
===================================================================
--- mongopersist/trunk/src/mongopersist/zope/container.py	2012-01-13 07:21:46 UTC (rev 124036)
+++ mongopersist/trunk/src/mongopersist/zope/container.py	2012-01-13 20:21:34 UTC (rev 124037)
@@ -21,8 +21,8 @@
 from zope.container.interfaces import IContainer
 
 from mongopersist import interfaces, serialize
+from mongopersist.zope import interfaces as zinterfaces
 
-
 class MongoContained(contained.Contained):
 
     @getproperty
@@ -87,7 +87,7 @@
 class MongoContainer(contained.Contained,
                      persistent.Persistent,
                      UserDict.DictMixin):
-    zope.interface.implements(IContainer)
+    zope.interface.implements(IContainer, zinterfaces.IMongoContainer)
     _m_database = None
     _m_collection = None
     _m_mapping_key = 'key'

Added: mongopersist/trunk/src/mongopersist/zope/interfaces.py
===================================================================
--- mongopersist/trunk/src/mongopersist/zope/interfaces.py	                        (rev 0)
+++ mongopersist/trunk/src/mongopersist/zope/interfaces.py	2012-01-13 20:21:34 UTC (rev 124037)
@@ -0,0 +1,95 @@
+##############################################################################
+#
+# Copyright (c) 2011 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (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.
+#
+##############################################################################
+"""Mongo Persistence Zope Container Interfaces"""
+import zope.interface
+import zope.schema
+
+
+class IMongoContainer(zope.interface.Interface):
+    _m_database = zope.schema.ASCIILine(
+        title=u'Mongo Database',
+        description=(
+            u'Specifies the MDB in which to store items. If ``None``, the '
+            u'default database will be used.'),
+        default=None)
+
+    _m_collection = zope.schema.ASCIILine(
+        title=u'Mongo Collection',
+        description=(
+            u'Specifies the Mongo collection in which to store items.')
+        )
+
+    _m_mapping_key = zope.schema.ASCIILine(
+        title=u'Mapping Key',
+        description=(
+            u'Specifies the attribute name of the item that is used as the '
+            u'mapping/dictionary/container key.'),
+        default='key')
+
+    _m_parent_key = zope.schema.ASCIILine(
+        title=u'Parent Key',
+        description=(
+            u'Specifies the attribute name of the item that is used to store '
+            u'the parent/container reference.'),
+        default='parent')
+
+    def _m_get_parent_key_value():
+        """Returns the value that is used to specify a particular container as
+        the parent of the item.
+        """
+
+    def _m_get_items_filter():
+        """Returns a query spec representing a filter that only returns
+        objects in this container."""
+
+    def get_collection():
+        """Get the Python representation of the collection.
+
+        This can be useful to make custom queries against the collection.
+        """
+
+    def raw_find(spec=None, *args, **kwargs):
+        """Return a raw Mongo result set for the specified query.
+
+        The spec is updated to also contain the container's filter spec.
+
+        See pymongo's documentation for details on *args and **kwargs.
+        """
+
+    def find(spec=None, fields=None, *args, **kwargs):
+        """Return a Python object result set for the specified query.
+
+        By default only the Mongo Id and key attribute is requested and a
+        ghost is created. The rest of the data is only retrieved if needed.
+
+        The spec is updated to also contain the container's filter spec.
+
+        See pymongo's documentation for details on *args and **kwargs.
+        """
+
+    def raw_find_one(spec_or_id=None, *args, **kwargs):
+        """Return a raw Mongo document for the specified query.
+
+        The spec is updated to also contain the container's filter spec.
+
+        See pymongo's documentation for details on *args and **kwargs.
+        """
+
+    def find_one(spec_or_id=None, fields=None, *args, **kwargs):
+        """Return a single Python object for the specified query.
+
+        The spec is updated to also contain the container's filter spec.
+
+        See pymongo's documentation for details on *args and **kwargs.
+        """


Property changes on: mongopersist/trunk/src/mongopersist/zope/interfaces.py
___________________________________________________________________
Added: svn:keywords
   + Id



More information about the checkins mailing list