Merge with 6f0fb6086bf396ea9083db6edd5d468612f85be0 ZTK-1.1
authorThierry Florac <tflorac@ulthar.net>
Mon, 12 Dec 2011 15:32:50 +0100
branchZTK-1.1
changeset 103 088a873802df
parent 92 bf59a3d6e437 (current diff)
parent 93 6f0fb6086bf3 (diff)
child 104 9355f0a396de
Merge with 6f0fb6086bf396ea9083db6edd5d468612f85be0
.pydevproject
--- a/.pydevproject	Sat Dec 10 01:33:04 2011 +0100
+++ b/.pydevproject	Mon Dec 12 15:32:50 2011 +0100
@@ -4,7 +4,7 @@
 <pydev_project>
 <pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
 <pydev_pathproperty name="org.python.pydev.PROJECT_SOURCE_PATH">
-<path>/ztfy.utils</path>
+<path>/ZTFY.utils (hg)</path>
 </pydev_pathproperty>
 
 <pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Python 2.6 (BB)</pydev_property>
--- a/ztfy/utils/interfaces.py	Sat Dec 10 01:33:04 2011 +0100
+++ b/ztfy/utils/interfaces.py	Mon Dec 12 15:32:50 2011 +0100
@@ -23,9 +23,120 @@
 # import local interfaces
 
 # import Zope3 packages
+from zope.interface import Interface
 
 # import local packages
 
 
 class INewSiteManagerEvent(IObjectEvent):
     """Event interface for new site manager event"""
+
+
+#
+# Generic list interface
+#
+
+class IListInfo(Interface):
+    """Custom interface used to handle list-like components"""
+
+    def count():
+        """Get list items count"""
+
+    def index():
+        """Get position of the given item"""
+
+    def __contains__():
+        """Check if given value is int list"""
+
+    def __getitem__():
+        """Return item at given position"""
+
+    def __iter__():
+        """Iterator over list items"""
+
+
+class IListWriter(Interface):
+    """Writer interface for list-like components"""
+
+    def append():
+        """Append value to list"""
+
+    def extend():
+        """Extend list with given items"""
+
+    def insert():
+        """Insert item to given index"""
+
+    def pop():
+        """Pop item from list and returns it"""
+
+    def remove():
+        """Remove given item from list"""
+
+    def reverse():
+        """Sort list in reverse order"""
+
+    def sort():
+        """Sort list"""
+
+
+class IList(IListInfo, IListWriter):
+    """Marker interface for list-like components"""
+
+
+#
+# Generic dict interface
+#
+
+class IDictInfo(Interface):
+    """Custom interface used to handle dict-like components"""
+
+    def keys():
+        """Get list of keys for the dict"""
+
+    def has_key(key):
+        """Check to know if dict includes the given key"""
+
+    def get(key, default=None):
+        """Get given key or default from dict"""
+
+    def copy():
+        """Duplicate content of dict"""
+
+    def __contains__(key):
+        """Check if given key is in dict"""
+
+    def __getitem__(key):
+        """Get given key value from dict"""
+
+    def __iter__():
+        """Iterator over dictionnary keys"""
+
+
+class IDictWriter(Interface):
+    """Writer interface for dict-like components"""
+
+    def clear():
+        """Clear dict"""
+
+    def update(b):
+        """Update dict with given values"""
+
+    def setdefault(key, failobj=None):
+        """Create value for given key if missing"""
+
+    def pop(key, *args):
+        """Remove and return given key from dict"""
+
+    def popitem():
+        """Pop item from dict"""
+
+    def __setitem__(key, value):
+        """Update given key with given value"""
+
+    def __delitem__(key):
+        """Remove selected key from dict"""
+
+
+class IDict(IDictInfo, IDictWriter):
+    """Marker interface for dict-like components"""