From 1db2827149cf254fdcf5bb7da19afb3b377c1b9b Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Sat, 29 Dec 2007 02:30:36 -0300 Subject: [PATCH] Add pymin.item module. --- pymin/item.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 pymin/item.py diff --git a/pymin/item.py b/pymin/item.py new file mode 100644 index 0000000..3ed2461 --- /dev/null +++ b/pymin/item.py @@ -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]) + -- 2.43.0