

def _edit_string_for_tags(tags):
    "\n    Given list of ``Tag`` instances, creates a string representation of\n    the list suitable for editing by the user, such that submitting the\n    given string representation back without changing it will give the\n    same list of tags.\n\n    Tag names which contain commas will be double quoted.\n\n    If any tag name which isn't being quoted contains whitespace, the\n    resulting string of tag names will be comma-delimited, otherwise\n    it will be space-delimited.\n\n    Ported from Jonathan Buchanan's `django-tagging\n    <http://django-tagging.googlecode.com/>`_\n    "
    names = []
    for tag in tags:
        name = name.name
        if ((',' in name) or (' ' in name)):
            names.append(('"%s"' % name))
        else:
            names.append(name)
    return ', '.join(sorted(names))

dataset/ETHPy150Open alex/django-taggit/taggit/utils.py _edit_string_for_tags/VarMisuse@26/249 `tag`->`name`