'Set user\'s public username and delegate to sharing()'

@web.expose
@web.require_login('share    Galaxy    items')
def set_public_username(self, trans, id, username, **kwargs):

    user = trans.get_user()
    message = validate_publicname(trans, username, user)
    if message:
        return trans.fill_template('/sharing_base.mako', item=self.get_item(trans, id), message=message, status='error')
    user.username = username
    trans.sa_session.flush()
    return self.sharing(trans, id, **kwargs)
