]> git.llucax.com Git - software/pymin.git/commitdiff
Add pymin.item module.
authorLeandro Lucarella <llucax@gmail.com>
Sat, 29 Dec 2007 05:30:36 +0000 (02:30 -0300)
committerLeandro Lucarella <llucax@gmail.com>
Sat, 29 Dec 2007 05:30:36 +0000 (02:30 -0300)
pymin/item.py [new file with mode: 0644]

diff --git a/pymin/item.py b/pymin/item.py
new file mode 100644 (file)
index 0000000..3ed2461
--- /dev/null
@@ -0,0 +1,23 @@
+# vim: set et sts=4 sw=4 encoding=utf-8 :
+
+r"Simple module that provides a validated and sequenced Item."
+
+from pymin.seqtools import Sequence
+from pymin.validatedclass import ValidatedClass
+
+class Item(ValidatedClass, Sequence):
+    r"""Item() -> Item object
+
+    Utility class to inherit from to get validation and sequence behaviour.
+
+    Please see pymin.seqtools and pymin.validatedclass modules help for
+    more details.
+    """
+
+    def as_tuple(self):
+        r"""as_tuple() -> tuple - Return tuple representing the object.
+
+        The tuple returned preserves the validated fields declaration order.
+        """
+        return tuple([getattr(self, n) for n in self.validated_fields])
+