'Mark a repository in the tool shed as deprecated or not deprecated.'

@web.expose
@web.require_login('deprecate    repository')
def deprecate(self, trans, **kwd):

    message = escape(kwd.get('message', ''))
    status = kwd.get('status', 'done')
    repository_id = kwd.get('id', None)
    repository = repository_util.get_repository_in_tool_shed(trans.app, repository_id)
    mark_deprecated = util.string_as_bool(kwd.get('mark_deprecated', False))
    repository.deprecated = mark_deprecated
    trans.sa_session.add(repository)
    trans.sa_session.flush()
    if mark_deprecated:
        trans.app.repository_registry.remove_entry(repository)
        message = ('The    repository    <b>%s</b>    has    been    marked    as    deprecated.' % escape(repository.name))
    else:
        trans.app.repository_registry.add_entry(repository)
        message = ('The    repository    <b>%s</b>    has    been    marked    as    not    deprecated.' % escape(repository.name))
    trans.response.send_redirect(web.url_for(controller='repository', action='browse_repositories', operation='repositories_i_own', message=message, status=status))
