[Zope-dev] TALES idea: tuple unpacking
Jean Jordaan
jean@upfrontsystems.co.za
Wed, 23 Jul 2003 09:16:43 +0200
> Say a method listFilesByUser returns a list of (user, [files]) it'd be nice to
> be able to::
>
> tal:repeat="user,files here/listFilesByUser"
>
> or similar. Currently we would have to use a python: expression to manually
> unpack the tuple. Kinda yucky.
yeah, or make listFilesByUser return {'username': user, 'files': files} and::
<tal:x repeat="user_dict here/listFilesByUser">
<tal:y define="user user_dict/username;
files user_dict/files" />
</tal:x>
also not ideal. I think the format in your example works well.
--
Jean Jordaan
http://www.upfrontsystems.co.za