def cat_comma_snippet(tag_to_be_split_with_cat_comma):
"""
Take a iterable list of web2py tag(s) and return tags splitted with CAT(', ')
"""
tags_with_cat = []
if len(tag_to_be_split_with_cat_comma) > 1:
for i, l in enumerate(tag_to_be_split_with_cat_comma):
if i + 1 < len(tag_to_be_split_with_cat_comma):
tags_with_cat.extend([l, CAT(', ')])
else:
tags_with_cat.append(l)
else:
tags_with_cat = tag_to_be_split_with_cat_comma
return tags_with_cat
[A('item1_represent', _href=URL('controller', 'function', args='agrs', vars=dict(record_id=1)), A('item2_represent', _href=URL('controller', 'function', args='agrs', vars=dict(record_id=2)), ...]
[A('item1_represent', _href=URL('controller', 'function', args='agrs', vars=dict(record_id=1)), CAT(', '), A('item2_represent', _href=URL('controller', 'function', args='agrs', vars=dict(record_id=2)), ...]