Bug 1080645:  Cannot delete Course containing non-english-character
===================================================================

When you try to delete a course, if the school year or the course was
created with a non-ascii title, you get an exception.

Look at https://bugs.launchpad.net/bugs/1080645

We'll make sure that doesn't happen anymore.

Helper:

    >>> def print_courses(browser):
    ...     sel = 'table.data tbody tr'
    ...     for tr in browser.query_all.css(sel):
    ...         title, course_id = tr.query_all.tag('td')
    ...         print '%s, %s' % (title.query.tag('a').text, course_id.text)

Log in as manager:

    >>> manager = browsers.manager
    >>> manager.ui.login('manager', 'schooltool')

Create two school years, one with a non-ascii title:

    >>> manager.ui.schoolyear.add('2012', '2012-01-01', '2012-12-31')
    >>> manager.ui.schoolyear.add(u'Año2013', '2013-01-01', '2013-12-31')

Create two courses for each year:

    >>> manager.ui.course.add('2012', u'Matemáticas', course_id='es')
    >>> manager.ui.course.add('2012', 'Math', course_id='en')

    >>> manager.ui.course.add(u'Año2013', u'Matemáticas', course_id='es')
    >>> manager.ui.course.add(u'Año2013', 'Math', course_id='en')

Let's visit the 2012 courses:

    >>> manager.query.link('School').click()
    >>> manager.query.link('Courses').click()
    >>> print manager.query.css('.page .header h1').text
    Courses for 2012
    >>> print_courses(manager)
    Matemáticas, es
    Math, en

And delete one:

    >>> manager.query.link('Matemáticas').click()
    >>> manager.query.link('Delete').click()
    >>> dialog = manager.query.css('.ui-dialog')
    >>> manager.wait_page(dialog.query.button('Delete').click)
    >>> manager.url
    u'http://localhost/courses?schoolyear_id=2012'
    >>> print manager.query.css('.page .header h1').text
    Courses for 2012
    >>> print_courses(manager)
    Math, en

Let's visit the 2013 courses:

    >>> manager.query.link('School').click()
    >>> manager.query.link('Courses').click()
    >>> manager.query.link('Año2013').click()
    >>> print manager.query.css('.page .header h1').text
    Courses for Año2013
    >>> print_courses(manager)
    Matemáticas, es
    Math, en

And delete one:

    >>> manager.query.link('Math').click()
    >>> manager.query.link('Delete').click()
    >>> dialog = manager.query.css('.ui-dialog')
    >>> manager.wait_page(dialog.query.button('Delete').click)
    >>> manager.url
    u'http://localhost/courses?schoolyear_id=A%C3%B1o2013'
    >>> print manager.query.css('.page .header h1').text
    Courses for Año2013
    >>> print_courses(manager)
    Matemáticas, es
