Without existing timetables related to the term
===============================================

A manager logs in

    >>> manager = Browser('manager', 'schooltool')

Set the time:

    >>> manager.open('http://localhost/time')
    >>> manager.getControl('Today').value = "2005-02-15"
    >>> manager.getControl('Apply').click()

    >>> 'Data successfully updated.' in manager.contents
    True

And create a new school year:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('School Years').click()
    >>> manager.getLink('New School Year').click()
    >>> manager.getControl('Title').value = '2007'
    >>> manager.getControl('First day').value = '2007-01-01'
    >>> manager.getControl('Last day').value = '2007-12-15'
    >>> manager.getControl('Add').click()

Create a term

    >>> manager.getLink('Add a new term').click()
    >>> manager.getControl('Title').value = 'Term 1'
    >>> manager.getControl('Start date').value = '2007-07-01'
    >>> manager.getControl('End date').value = '2007-07-12'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Saturday').click()
    >>> manager.getControl('Sunday').click()
    >>> manager.getControl('Add term').click()

So now we have one term

    >>> 'Term 1' in manager.contents
    True
    >>> manager.getControl(name='delete.term-1').value = True
    >>> manager.getControl('Delete').click()
    >>> 'Are you sure you want to delete the selected terms?' in manager.contents
    True
    >>> 'Term 1' in manager.contents
    True
    >>> print manager.contents
    <BLANKLINE>
    <BLANKLINE>
    ...
      Are you sure you want to delete the selected terms?
    ...
    >>> manager.getControl('Confirm').click()

    >>> print analyze.queryHTML('//h1', manager.contents)[0]
    <h1>
      2007
      (Jan 1, 2007
      &#8212;
       Dec 15, 2007)
    </h1>

    >>> analyze.queryHTML('//div[@class="term"]', manager.contents)
    []

What now if we cancel the deletion ?

Create a term

    >>> manager.getLink('2007').click()
    >>> manager.getLink('Add a new term').click()
    >>> manager.getControl('Title').value = 'Term 2'
    >>> manager.getControl('Start date').value = '2007-07-01'
    >>> manager.getControl('End date').value = '2007-07-12'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Saturday').click()
    >>> manager.getControl('Sunday').click()
    >>> manager.getControl('Add term').click()

So now we have one term

    >>> 'Term 2' in manager.contents
    True
    >>> manager.getControl(name='delete.term-2').value = True
    >>> manager.getControl('Delete').click()
    >>> manager.getControl('Cancel').click()

We cancel so the term is still there:

    >>> print analyze.queryHTML('//h1', manager.contents)[0]
    <h1>
      2007
      (Jan 1, 2007
      &#8212;
       Dec 15, 2007)
    </h1>

    >>> print analyze.queryHTML('//div[@class="term"]', manager.contents)[0]
    <div class="term">
       <input type="checkbox" name="delete.term-2" id="delete.term-2" /><a href="http://localhost/schoolyears/2007/term-2">Term 2</a>
       (Jul 1, 2007
       &#8212;
        Jul 12, 2007)
    </div>
