示例#1
0
 def write_note_feed(self, file, notes, url, title, subtitle, updated):
     """Takes a list of notes and writes a PFIF Atom feed to a file."""
     file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
     file.write('<feed xmlns="http://www.w3.org/2005/Atom"\n')
     file.write('      xmlns:pfif="%s">\n' % self.pfif_version.ns)
     write_element(file, 'id', url, '  ')
     write_element(file, 'title', title, '  ')
     write_element(file, 'subtitle', subtitle, '  ')
     write_element(file, 'updated', format_utc_datetime(updated), '  ')
     file.write('  <link rel="self">%s</link>\n' % xml_escape(url))
     for note in notes:
         self.write_note_entry(file, note, '  ')
     file.write('</feed>\n')
示例#2
0
 def write_note_feed(self, file, notes, url, title, subtitle, updated):
     """Takes a list of notes and writes a PFIF Atom feed to a file."""
     file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
     file.write('<feed xmlns="http://www.w3.org/2005/Atom"\n')
     file.write('      xmlns:pfif="%s">\n' % self.pfif_version.ns)
     write_element(file, 'id', url, '  ')
     write_element(file, 'title', title, '  ')
     write_element(file, 'subtitle', subtitle, '  ')
     write_element(file, 'updated', format_utc_datetime(updated), '  ')
     file.write('  <link rel="self">%s</link>\n' % xml_escape(url))
     for note in notes:
         self.write_note_entry(file, note, '  ')
     file.write('</feed>\n')
示例#3
0
 def write_person_feed(self, file, persons, get_notes_for_person,
                       url, title, subtitle, updated):
   """Takes a list of person records and a function that gets the list of note
   records for each person, and writes a PFIF Atom feed to the given file."""
   file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
   file.write('<feed xmlns="http://www.w3.org/2005/Atom"\n')
   file.write('      xmlns:pfif="%s">\n' % self.pfif_version.ns)
   write_element(file, 'id', url, '  ')
   write_element(file, 'title', title, '  ')
   write_element(file, 'subtitle', subtitle, '  ')
   write_element(file, 'updated', format_utc_datetime(updated), '  ')
   file.write('  <link rel="self">%s</link>\n' % xml_escape(url))
   for person in persons:
     self.write_person_entry(
         file, person, get_notes_for_person(person), title, '  ')
   file.write('</feed>\n')
示例#4
0
 def write_person_feed(self, file, persons, get_notes_for_person, url,
                       title, subtitle, updated):
     """Takes a list of person records and a function that gets the list
     of note records for each person, and writes a PFIF Atom feed to the
     given file."""
     file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
     file.write('<feed xmlns="http://www.w3.org/2005/Atom"\n')
     file.write('      xmlns:pfif="%s">\n' % self.pfif_version.ns)
     write_element(file, 'id', url, '  ')
     write_element(file, 'title', title, '  ')
     write_element(file, 'subtitle', subtitle, '  ')
     write_element(file, 'updated', format_utc_datetime(updated), '  ')
     file.write('  <link rel="self">%s</link>\n' % xml_escape(url))
     for person in persons:
         self.write_person_entry(file, person, get_notes_for_person(person),
                                 title, '  ')
     file.write('</feed>\n')