Python

Bake-off Code 2 Pseduo-code

Plan for failure:

It isn't going to work the first time. In fact, I'm probably not going to successfully complete the login sequence. So just to make sure I understand it correctly, I'll prototype it with wget.

wget \
--no-check-certificate \
--server-response \
--post-data='Passwd=mypass&source=testsrcEmail=me@gmail.com&service=cl' \
--header='Content-Type: application/x-www-form-urlencoded' \
'https://www.google.com/accounts/ClientLogin'

Bake-off Code 2

Python Code

test-session.py

#!/usr/bin/env python
# Test suite for my Outlook and Google session objects.

import sys
sys.path.append('..')
import unittest
from google.gsession  import GoogleSession
from outlook.osession import OutlookSession


class TestSession(unittest.TestCase):

    #################################################################
    # I can set these to fixed values to prevent a prompt for ID/password,
    # but I don't want to post to my blog with meaningful values here!
    #################################################################

Bake-off Top Level Design

Create a routine that creates a Google data session and an Outlook data session

Retrieve each calendar (is-a or has-a array of events)
Merge the two calendars into a single (new) calendar
GoogleCalendar = mergedCalendar
OutlookCalendar = mergedCalendar
GoogleCalendar.persist
OutlookCalendar.persist

Planned Unit Tests for Bake-off Code 2

I'll need 'session' objects for both Google and Outlook. Sessions can do the following:

  • Start-up
  • Shut-down
  • Give me the full calendar
  • Make the full calendar look like this

I'm deliberately keeping sessions as stupid as possible. -------------------------------------------- OBSOLETE CONTENT FOLLOWS



Now I'll begin to flesh out Calendar.merge. For starters, I'll create an AbstractCalendar class and specialize it into GoogleCalendar and OutlookCalendar. Calendars will support the following methods (for now):

  • load
  • merge

Why Do a Bake-off?

There are several programming languages that interest me lately:

Syndicate content