~replaceafill/schooltool/database_exporter

« back to all changes in this revision

Viewing changes to src/schooltool/db_exporter/mock_0_11_4.py

  • Committer: Douglas Cerna
  • Date: 2010-11-17 07:35:44 UTC
  • Revision ID: douglascerna@yahoo.com-20101117073544-ci0ezfpnhnak3b9o
Added sheet writer for persons details

Show diffs side-by-side

added added

removed removed

Lines of Context:
148
148
                ])
149
149
 
150
150
 
 
151
class PersonDetailsSheetWriter(SimpleSheetWriter):
 
152
 
 
153
    sheet_name = 'Persons Details'
 
154
    collect_instances = Person
 
155
 
 
156
    def write(self):
 
157
        persons = sorted(self.objects, key=zope_name)
 
158
 
 
159
        fields = (
 
160
            'User Name', 'Nickname', 'Primary Email',
 
161
            'Secondary Email', 'Primary phone',
 
162
            'Secondary phone', 'Mailing address',
 
163
            'Website' )
 
164
 
 
165
        self.writeRow(
 
166
            fields,
 
167
            style=self.styles.header)
 
168
 
 
169
        for person in persons:
 
170
            details = person._details
 
171
            self.writeRow([person.username, details.nickname,
 
172
                           details.primary_email, details.secondary_email,
 
173
                           details.primary_phone, details.secondary_phone,
 
174
                           details.mailing_address, details.home_page])
 
175
 
 
176
 
151
177
class TimetableDict(PersistentDict):
152
178
    __name__ = 'timetables'
153
179
    __parent__ = None
593
619
    'groups': GroupSheetWriter,
594
620
    'courses': CourseSheetWriter,
595
621
    'sections': SectionMultiSheetsWriter,
 
622
    'details': PersonDetailsSheetWriter,
596
623
    }
597
624
 
598
625