'Apply a new set of tags to an item; previous tags are deleted.'

@web.expose
@web.require_login('Apply    a    new    set    of    tags    to    an    item;    previous    tags    are    deleted.')
def retag_async(self, trans, item_id=None, item_class=None, new_tags=None):

    item = self._get_item(trans, item_class, trans.security.decode_id(item_id))
    user = trans.user
    self.get_tag_handler(trans).delete_item_tags(user, item)
    self.get_tag_handler(trans).apply_item_tags(user, item, new_tags.encode('utf-8'))
    trans.sa_session.flush()
