From: Leandro Lucarella Date: Sat, 29 Dec 2007 05:30:36 +0000 (-0300) Subject: Add pymin.item module. X-Git-Url: https://git.llucax.com/software/pymin.git/commitdiff_plain/1db2827149cf254fdcf5bb7da19afb3b377c1b9b?ds=inline;hp=--cc Add pymin.item module. --- 1db2827149cf254fdcf5bb7da19afb3b377c1b9b 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]) +