Attachment 'models.py'
Download 1 #----------------------------------------------------------------------------
2 # Name: models.py
3 # Purpose: Hold the application data
4 #
5 # Author: Peter Damoc (peter at sigmacore.net)
6 # adapted from Martin Fowler's MVP example
7 # Created: January 2006
8 # Version: 0.1
9 # Licence: wxWindows license
10
11 class Album(object):
12 '''
13 Just a dumb object that incapsulates the information of the album
14 '''
15 def __init__(self, artist, title, isClassical=False, composer=None):
16 self.artist = artist
17 self.title = title
18 self.isClassical = isClassical
19 self.composer = composer
20
21 someAlbums = [
22 ("Mike Oldfield", "The Songs of Distant Earth"),
23 ("Loreena McKennitt", "The Visit"),
24 ("Music Instructor", "Electric City"),
25 ("Domingo, Plowright, Fassbaender, Zancanaro, Nesterenko", "Il Trovatore", True, "Giuseppe Verdi"),
26 ("Riccardo Muti", "Rigoletto", True, "Giuseppe Verdi")
27 ]
28
29 def GetDemoAlbums():
30 '''Just transforms a list of tuples containing data into a list of Albums using list comprehension'''
31 return [Album(*data) for data in someAlbums]
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.