'Display the list of repositories owned by a specified user.'

@web.expose
def browse_repositories_by_user(self, trans, **kwd):

    for (k, v) in kwd.items():
        if k.startswith('f-'):
            del kwd[k]
    if ('operation' in kwd):
        operation = kwd['operation'].lower()
        if (operation == 'view_or_manage_repository'):
            return trans.response.send_redirect(web.url_for(controller='repository', action='view_or_manage_repository', **kwd))
    user_id = kwd.get('user_id', None)
    if (user_id is None):
        repository_id = kwd.get('id', None)
        if repository_id:
            repository = repository_util.get_repository_in_tool_shed(trans.app, repository_id)
            user_id = trans.security.encode_id(repository.user.id)
            kwd['user_id'] = user_id
        else:
            (selected_changeset_revision, repository) = suc.get_repository_from_refresh_on_change(trans.app, **kwd)
            if repository:
                return trans.response.send_redirect(web.url_for(controller='repository', action='view_or_manage_repository', id=trans.security.encode_id(repository.id), changeset_revision=selected_changeset_revision))
    if user_id:
        user = suc.get_user(trans.app, user_id)
        trailing_string = ''
        default = ('Repositories    Owned    by    %s' % str(user.username))
    else:
        trailing_string = ''
        default = 'Repositories'
    title = trans.app.repository_grid_filter_manager.get_grid_title(trans, trailing_string=trailing_string, default=default)
    self.repositories_by_user_grid.title = title
    return self.repositories_by_user_grid(trans, **kwd)
