def writehead(self,id,name,who,where): if self._alt: print >>self._writer,altfmt.write((("id",id),("name",name),("org",who),("location",where))) for k in sorted(self._metadata.keys()): for v in self._metadata[k]: print >>self._writer,altfmt.write([('metadata',k),('value',v)]) else: self._write_unicode([id,name,who,where]) self._write_unicode([]) headings = ['Course','Type','Organiser','Subject','Pattern','Where','Merge',''] for k in sorted(self._metadata.keys()): headings.append(k) self._write_unicode(headings)
def writehead(self, id, name, who, where): if self._alt: print >> self._writer, altfmt.write( (("id", id), ("name", name), ("org", who), ("location", where))) for k in sorted(self._metadata.keys()): for v in self._metadata[k]: print >> self._writer, altfmt.write([('metadata', k), ('value', v)]) else: self._write_unicode([id, name, who, where]) self._write_unicode([]) headings = [ 'Course', 'Type', 'Organiser', 'Subject', 'Pattern', 'Where', 'Merge', '' ] for k in sorted(self._metadata.keys()): headings.append(k) self._write_unicode(headings)
def writerow(self,course,type,who,what,when,where,merge): if self._alt: print >>self._writer,altfmt.write((('course',course),('type',type),('who',who),('what',what),('when',str(when)),('where',where),('merge',"yes" if merge else "no"))) else: row = [course,type,who,what,str(when),where,"yes" if merge else "no",''] for k in sorted(self._metadata.keys()): if len(self._metadata[k]) > self._row_count: text = self._metadata[k][self._row_count] else: text = '' row.append(text) self._row_count += 1 self._write_unicode(row)
def writerow(self, course, type, who, what, when, where, merge): if self._alt: print >> self._writer, altfmt.write( (('course', course), ('type', type), ('who', who), ('what', what), ('when', str(when)), ('where', where), ('merge', "yes" if merge else "no"))) else: row = [ course, type, who, what, str(when), where, "yes" if merge else "no", '' ] for k in sorted(self._metadata.keys()): if len(self._metadata[k]) > self._row_count: text = self._metadata[k][self._row_count] else: text = '' row.append(text) self._row_count += 1 self._write_unicode(row)