Beispiel #1
0
def write_edu_info(outfile):
    """Lag en fil med informasjon om alle studentenes 'aktiviteter' registrert
    i FS.

    Spesifikt, lister vi opp alle deltagelser ved:

      - undenh
      - undakt
      - kullklasser
      - kull
    """

    logger.info("Writing edu info for all students")
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    for xml_tag, generator in (
        ("undenh", fs.undervisning.list_studenter_alle_undenh),
        ("undakt", fs.undervisning.list_studenter_alle_undakt),
        ("kullklasse", fs.undervisning.list_studenter_alle_kullklasser),
        ("kull", fs.undervisning.list_studenter_alle_kull)):
        logger.debug("Processing %s entries", xml_tag)
        for row in generator():
            keys = row.keys()
            f.write(xml.xmlify_dbrow(row, keys, xml_tag) + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #2
0
def write_undenh_student(outfile):
    """Skriv oversikt over personer oppmeldt til undervisningsenheter.
    Tar med data for alle undervisingsenheter i inneværende+neste
    semester."""
    f = MinimumSizeWriter(outfile)
    f.min_size = 5 * KiB
    f.write(xml.xml_hdr + "<data>\n")
    for semester in ('current', 'next'):
        cols, undenh = _ext_cols(
            fs.undervisning.list_undervisningenheter(sem=semester))
        for u in undenh:
            u_attr = {}
            for k in ('institusjonsnr', 'emnekode', 'versjonskode', 'terminnr',
                      'terminkode', 'arstall'):
                u_attr[k] = u[k]
            student_cols, student = _ext_cols(
                fs.undervisning.list_studenter_underv_enhet(**u_attr))
            for s in student:
                s_attr = u_attr.copy()
                for k in ('fodselsdato', 'personnr'):
                    s_attr[k] = s[k]
                f.write(
                    xml.xmlify_dbrow({}, (), 'student', extra_attr=s_attr) +
                    "\n")
    f.write("</data>\n")
    f.close()
Beispiel #3
0
def write_hia_person_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 1 * MiB
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive ordinære studenter ved HiA
    cols, hiastudent = _ext_cols(fs.student.list_aktiv())
    for a in hiastudent:
        fix_float(a)
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols), 'aktiv') + "\n")
    # Eksamensmeldinger
    cols, hiastudent = _ext_cols(fs.student.list_eksamensmeldinger())
    for s in hiastudent:
        f.write(xml.xmlify_dbrow(s, xml.conv_colnames(cols), 'eksamen') + "\n")
    # Privatister ved HiA
    cols, hiastudent = _ext_cols(fs.student.list_privatist())
    for p in hiastudent:
        f.write(
            xml.xmlify_dbrow(p, xml.conv_colnames(cols),
                             'privatist_studieprogram') + "\n")
    # EVU-studenter ved HiA
    cols, hiastudent = _ext_cols(fs.evu.list())
    for e in hiastudent:
        f.write(xml.xmlify_dbrow(e, xml.conv_colnames(cols), 'evu') + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #4
0
def output_text(output_file):
    """
    Initialize data structures and start generating the output.
    """

    output_stream = MinimumSizeWriter(output_file, "w")
    # 1MB is the minimum allowed size for the portal dump.
    # The number is somewhat magic, but it seems sensible
    output_stream.min_size = 1024*1024
    db_cerebrum = Factory.get("Database")()
    logger.debug(cereconf.DB_AUTH_DIR)
    
    logger.debug(Database.__file__)
    db = Database.connect(user="******",
                          service="FSPROD.uio.no",
                          DB_driver=cereconf.DB_DRIVER_ORACLE)
    db_fs = FS(db)
    
    db_person = Factory.get("Person")(db_cerebrum)
    db_account = Factory.get("Account")(db_cerebrum)
    constants = Factory.get("Constants")(db_cerebrum)

    # FS is first. This is intentional.
    lookup_order = [constants.system_fs]
    for authoritative_system_name in cereconf.SYSTEM_LOOKUP_ORDER:
        lookup_order.append(getattr(constants, authoritative_system_name))
    
    rows = db_fs.portal.list_eksmeld()
    logger.debug("Fetched portal information from FS")
    for row in rows:
        output_row(row, output_stream,
                   db_person, db_account, constants,
                   lookup_order)

    output_stream.close()
Beispiel #5
0
def write_edu_info(outfile):
    """Lag en fil med informasjon om alle studentenes 'aktiviteter' registrert
    i FS.

    Spesifikt, lister vi opp alle deltagelser ved:

      - undenh
      - undakt
      - kullklasser
      - kull
    """

    logger.info("Writing edu info for all students")
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    for xml_tag, generator in (
        ("undenh", fs.undervisning.list_studenter_alle_undenh),
        ("undakt", fs.undervisning.list_studenter_alle_undakt),
        ("kullklasse", fs.undervisning.list_studenter_alle_kullklasser),
        ("kull", fs.undervisning.list_studenter_alle_kull)):
        logger.debug("Processing %s entries", xml_tag)
        for row in generator():
            keys = row.keys()
            f.write(xml.xmlify_dbrow(row, keys, xml_tag) + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #6
0
def write_person_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive fagpersoner ved NIH
    cols, fagperson = _ext_cols(fs.undervisning.list_fagperson_semester())
    for p in fagperson:
        f.write(
            xml.xmlify_dbrow(p, xml.conv_colnames(cols), 'fagperson') + "\n")
    # Aktive ordinære studenter ved NIH
    cols, student = _ext_cols(fs.student.list_aktiv())
    for a in student:
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols), 'aktiv') + "\n")
    # Eksamensmeldinger
    cols, student = _ext_cols(fs.student.list_eksamensmeldinger())
    for s in student:
        f.write(xml.xmlify_dbrow(s, xml.conv_colnames(cols), 'eksamen') + "\n")
    # EVU-studenter ved NIH
    cols, student = _ext_cols(fs.evu.list())
    for e in student:
        f.write(xml.xmlify_dbrow(e, xml.conv_colnames(cols), 'evu') + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #7
0
def write_person_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive fagpersoner ved HIH
    cols, fagperson = _ext_cols(fs.undervisning.list_fagperson_semester())
    for p in fagperson:
        f.write(xml.xmlify_dbrow(p, xml.conv_colnames(cols), 'fagperson') + "\n")
    # Aktive ordinære studenter ved HIH
    cols, student = _ext_cols(fs.student.list_aktiv())
    for a in student:
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols), 'aktiv') + "\n")
    # Eksamensmeldinger
    cols, student = _ext_cols(fs.student.list_eksamensmeldinger())
    for s in student:
        f.write(xml.xmlify_dbrow(s, xml.conv_colnames(cols), 'eksamen') + "\n")
     # EVU-studenter ved HIH
     # For now, HiH does not want to import information about EVU students
     # cols, student = _ext_cols(fs.evu.list())
     # for e in student:
     #     f.write(xml.xmlify_dbrow(e, xml.conv_colnames(cols), 'evu') + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #8
0
def write_hia_person_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 1*MiB
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive ordinære studenter ved HiA
    cols, hiastudent = _ext_cols(fs.student.list_aktiv())
    for a in hiastudent:
        fix_float(a)
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols),'aktiv') + "\n")
    # Eksamensmeldinger
    cols, hiastudent = _ext_cols(fs.student.list_eksamensmeldinger())
    for s in hiastudent:
        f.write(xml.xmlify_dbrow(s, xml.conv_colnames(cols), 'eksamen') + "\n")
    # Privatister ved HiA
    cols, hiastudent = _ext_cols(fs.student.list_privatist())
    for p in hiastudent:
        f.write(xml.xmlify_dbrow(p,xml.conv_colnames(cols),'privatist_studieprogram') + "\n")
    # EVU-studenter ved HiA
    cols, hiastudent = _ext_cols(fs.evu.list())
    for e in hiastudent:
        f.write(xml.xmlify_dbrow(e,xml.conv_colnames(cols),'evu') + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #9
0
def write_role_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 5 * KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, role = _ext_cols(fs.undervisning.list_alle_personroller())
    for r in role:
        f.write(xml.xmlify_dbrow(r, xml.conv_colnames(cols), 'rolle') + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #10
0
def write_role_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 5*KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, role = _ext_cols(fs.undervisning.list_alle_personroller())
    for r in role:
        f.write(xml.xmlify_dbrow(r, xml.conv_colnames(cols), 'rolle') + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #11
0
def write_evukurs_info(outfile):
    """Skriv data om alle EVU-kurs (vi trenger dette bl.a. for å bygge EVU-delen av CF)."""
    f = MinimumSizeWriter(outfile)
    f.min_size = 1*KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, evukurs = _ext_cols(fs.evu.list_kurs())
    for ek in evukurs:
        f.write(xml.xmlify_dbrow(ek, xml.conv_colnames(cols), "evukurs") + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #12
0
def write_evukurs_info(outfile):
    """Skriv data om alle EVU-kurs"""
    f = MinimumSizeWriter(outfile)
    f.min_size = 1*KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, evukurs = _ext_cols(fs.evu.list_kurs())
    for ek in evukurs:
        f.write(xml.xmlify_dbrow(ek, xml.conv_colnames(cols), "evukurs") + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #13
0
def write_studprog_info(outfile):
    """Lager fil med informasjon om alle definerte studieprogrammer"""
    f = MinimumSizeWriter(outfile)
    f.min_size = 10 * KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, dta = _ext_cols(fs.info.list_studieprogrammer())
    for t in dta:
        f.write(
            xml.xmlify_dbrow(t, xml.conv_colnames(cols), 'studprog') + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #14
0
def write_role_info(outfile):
    """Skriv data om alle registrerte roller"""
    logger.info("Writing role info to '%s'" % outfile)
    f = MinimumSizeWriter(outfile)
    f.min_size = 1*KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, role = _ext_cols(fs.undervisning.list_alle_personroller())
    for r in role:
	f.write(xml.xmlify_dbrow(r, xml.conv_colnames(cols), 'rolle') + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #15
0
def write_studprog_info(outfile):
    """Lager fil med informasjon om alle definerte studieprogrammer"""
    f = MinimumSizeWriter(outfile)
    f.min_size = 50*KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, dta = _ext_cols(fs.info.list_studieprogrammer())
    for t in dta:
        f.write(xml.xmlify_dbrow(t, xml.conv_colnames(cols), 'studprog')
                + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #16
0
def write_role_info(outfile):
    """Skriv data om alle registrerte roller"""
    logger.info("Writing role info to '%s'" % outfile)
    f = MinimumSizeWriter(outfile)
    f.min_size = 1 * KiB
    f.write(xml.xml_hdr + "<data>\n")
    cols, role = _ext_cols(fs.undervisning.list_alle_personroller())
    for r in role:
        f.write(xml.xmlify_dbrow(r, xml.conv_colnames(cols), 'rolle') + "\n")
    f.write("</data>\n")
    f.close()
Beispiel #17
0
def write_undenh_metainfo(outfile):
    "Skriv metadata om undervisningsenheter for inneværende+neste semester."
    f = MinimumSizeWriter(outfile)
    f.min_size = 5*KiB
    f.write(xml.xml_hdr + "<undervenhet>\n")
    for semester in ('current', 'next'):
        cols, undenh = _ext_cols(fs.undervisning.list_undervisningenheter(sem=semester))
        for u in undenh:
            f.write(xml.xmlify_dbrow(u, xml.conv_colnames(cols), 'undenhet')
                    + "\n")
    f.write("</undervenhet>\n")
    f.close()
def write_person_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive ordinære studenter ved HIH
    cols, student = _ext_cols(fs.student.list_aktiv_midlertidig())
    for a in student:
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols), 'aktiv') + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #19
0
def write_person_info(outfile):
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive ordinære studenter ved HIH
    cols, student = _ext_cols(fs.student.list_aktiv_midlertidig())
    for a in student:
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols), 'aktiv') + "\n")
        
    f.write("</data>\n")
    f.close()
Beispiel #20
0
def write_undenh_metainfo(outfile):
    "Skriv metadata om undervisningsenheter for inneværende+neste semester."
    f = MinimumSizeWriter(outfile)
    f.min_size = 100*KiB
    f.write(xml.xml_hdr + "<undervenhet>\n")
    for semester in ('current', 'next'):
        cols, undenh = _ext_cols(fs.undervisning.list_undervisningenheter(sem=semester))
        for u in undenh:
            f.write(xml.xmlify_dbrow(u, xml.conv_colnames(cols), 'undenhet')
                    + "\n")
    f.write("</undervenhet>\n")
    f.close()
Beispiel #21
0
def ephorte_export(spread_id, filename):
    global f
    f = MinimumSizeWriter(filename)
    f.min_size = 1*MiB
    ou.clear()
    ou.find(int(ou.root()[0]['ou_id']))
    f.write(xml.xml_hdr + "<persons>\n")
    f.write("<orgid>%s</orgid>\n" % ou.acronym.lower()) 
    for row in account.list_all_with_spread(spread_id):
      f.write("<person>\n")
      export_account(account_id=row['entity_id'])
      f.write("</person>\n")
    f.write("</persons>\n")
    f.close()
Beispiel #22
0
def ephorte_export(spread_id, filename):
    global f
    f = MinimumSizeWriter(filename)
    f.min_size = 1 * MiB
    ou.clear()
    ou.find(int(ou.root()[0]['ou_id']))
    f.write(xml.xml_hdr + "<persons>\n")
    f.write("<orgid>%s</orgid>\n" % ou.acronym.lower())
    for row in account.list_all_with_spread(spread_id):
        f.write("<person>\n")
        export_account(account_id=row['entity_id'])
        f.write("</person>\n")
    f.write("</persons>\n")
    f.close()
Beispiel #23
0
def write_ou_info(outfile):
    """Lager fil med informasjon om alle OU-er"""
    logger.info("Writing ou info to '%s'" % outfile)
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")
    cols, ouer = _ext_cols(fs.info.list_ou(cereconf.DEFAULT_INSTITUSJONSNR)) 
    for o in ouer:
        sted = {}
        for fs_col, xml_attr in (
            ('faknr', 'fakultetnr'),
            ('instituttnr', 'instituttnr'),
            ('gruppenr', 'gruppenr'),
            ('stedakronym', 'akronym'),
            ('stedakronym', 'forkstednavn'),
            ('stednavn_bokmal', 'stednavn'),
            ('stedkode_konv', 'stedkode_konv'),
            ('faknr_org_under', 'fakultetnr_for_org_sted'),
            ('instituttnr_org_under', 'instituttnr_for_org_sted'),
            ('gruppenr_org_under', 'gruppenr_for_org_sted'),
            ('adrlin1', 'adresselinje1_intern_adr'),
            ('adrlin2', 'adresselinje2_intern_adr'),
            ('postnr', 'poststednr_intern_adr'),
            ('adrlin1_besok', 'adresselinje1_besok_adr'),
            ('adrlin2_besok', 'adresselinje2_besok_adr'),
            ('postnr_besok', 'poststednr_besok_adr')):
            if o[fs_col] is not None:
                sted[xml_attr] = xml.escape_xml_attr(o[fs_col])
        komm = []
        for fs_col, typekode in (
            ('telefonnr', 'EKSTRA TLF'),
            ('faxnr', 'FAX'),
	    ('emailadresse','EMAIL'),
	    ('url', 'URL')):
            if o[fs_col]:               # Skip NULLs and empty strings
                komm.append({'kommtypekode': xml.escape_xml_attr(typekode),
                             'kommnrverdi': xml.escape_xml_attr(o[fs_col])})
        # TODO: Kolonnene 'url' og 'bibsysbeststedkode' hentes ut fra
        # FS, men tas ikke med i outputen herfra.
        f.write('<sted ' +
                ' '.join(["%s=%s" % item for item in sted.items()]) +
                '>\n')
        for k in komm:
            f.write('<komm ' +
                    ' '.join(["%s=%s" % item for item in k.items()]) +
                    ' />\n')
        f.write('</sted>\n')
    f.write("</data>\n")
    f.close()
Beispiel #24
0
def write_ou_info(outfile):
    """Lager fil med informasjon om alle OU-er"""
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")
    cols, ouer = _ext_cols(fs.info.list_ou(cereconf.DEFAULT_INSTITUSJONSNR)) 
    for o in ouer:
        sted = {}
        for fs_col, xml_attr in (
            ('faknr', 'fakultetnr'),
            ('instituttnr', 'instituttnr'),
            ('gruppenr', 'gruppenr'),
            ('stedakronym', 'akronym'),
            ('stedakronym', 'forkstednavn'),
            ('stednavn_bokmal', 'stednavn'),
            ('stedkode_konv', 'stedkode_konv'),
            ('faknr_org_under', 'fakultetnr_for_org_sted'),
            ('instituttnr_org_under', 'instituttnr_for_org_sted'),
            ('gruppenr_org_under', 'gruppenr_for_org_sted'),
            ('adrlin1', 'adresselinje1_intern_adr'),
            ('adrlin2', 'adresselinje2_intern_adr'),
            ('postnr', 'poststednr_intern_adr'),
            ('adrlin1_besok', 'adresselinje1_besok_adr'),
            ('adrlin2_besok', 'adresselinje2_besok_adr'),
            ('postnr_besok', 'poststednr_besok_adr')):
            if o[fs_col] is not None:
                sted[xml_attr] = xml.escape_xml_attr(o[fs_col])
        komm = []
        for fs_col, typekode in (
            ('telefonnr', 'EKSTRA TLF'),
            ('faxnr', 'FAX'),
            ('emailadresse','EMAIL'),
            ('url', 'URL')):
            if o[fs_col]:               # Skip NULLs and empty strings
                komm.append({'kommtypekode': xml.escape_xml_attr(typekode),
                             'kommnrverdi': xml.escape_xml_attr(o[fs_col])})
        # TODO: Kolonnene 'url' og 'bibsysbeststedkode' hentes ut fra
        # FS, men tas ikke med i outputen herfra.
        f.write('<sted ' +
                ' '.join(["%s=%s" % item for item in sted.items()]) +
                '>\n')
        for k in komm:
            f.write('<komm ' +
                    ' '.join(["%s=%s" % item for item in k.items()]) +
                    ' />\n')
        f.write('</sted>\n')
    f.write("</data>\n")
    f.close()
Beispiel #25
0
def write_person_info(outfile):
    logger.info("Writing person info to '%s'" % outfile)
    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    # Aktive fagpersoner ved HiØf
    cols, fagperson = _ext_cols(fs.undervisning.list_fagperson_semester())
    for p in fagperson:
        f.write(xml.xmlify_dbrow(p, xml.conv_colnames(cols), 'fagperson') + "\n")
    # Aktive ordinære studenter ved HiØf
    cols, student = _ext_cols(fs.student.list_aktiv())
    for a in student:
        f.write(xml.xmlify_dbrow(a, xml.conv_colnames(cols), 'aktiv') + "\n")
    # Eksamensmeldinger
    cols, student = _ext_cols(fs.student.list_eksamensmeldinger())
    for s in student:
        f.write(xml.xmlify_dbrow(s, xml.conv_colnames(cols), 'eksamen') + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #26
0
def write_kull_info(outfile):
    """Lag en fil med informasjon om alle studentenes kulldeltakelse
    registrert i FS.

    Spesifikt, lister vi opp alle deltagelser ved:
      - kullklasser
      - kull
    """

    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    for xml_tag, generator in (
        ("kullklasse", fs.undervisning.list_studenter_alle_kullklasser),
        ("kulldeltaker", fs.undervisning.list_studenter_alle_kull),
        ("kull", fs.info.list_kull)):
        for row in generator():
            keys = row.keys()
            f.write(xml.xmlify_dbrow(row, keys, xml_tag) + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #27
0
def write_kull_info(outfile):
    """Lag en fil med informasjon om alle studentenes kulldeltakelse
    registrert i FS.

    Spesifikt, lister vi opp alle deltagelser ved:
      - kullklasser
      - kull
    """

    f = MinimumSizeWriter(outfile)
    f.min_size = 0
    f.write(xml.xml_hdr + "<data>\n")

    for xml_tag, generator in (
        ("kullklasse", fs.undervisning.list_studenter_alle_kullklasser),
        ("kulldeltaker", fs.undervisning.list_studenter_alle_kull),
        ("kull", fs.info.list_kull)):
        for row in generator():
            keys = row.keys()
            f.write(xml.xmlify_dbrow(row, keys, xml_tag) + "\n")

    f.write("</data>\n")
    f.close()
Beispiel #28
0
def write_undenh_student(outfile):
    """Skriv oversikt over personer oppmeldt til undervisningsenheter.
    Tar med data for alle undervisingsenheter i inneværende+neste
    semester."""
    f = MinimumSizeWriter(outfile)
    f.min_size = 10*KiB
    f.write(xml.xml_hdr + "<data>\n")
    for semester in ('current', 'next'):
        cols, undenh = _ext_cols(fs.undervisning.list_undervisningenheter(sem=semester))
        for u in undenh:
            u_attr = {}
            for k in ('institusjonsnr', 'emnekode', 'versjonskode',
                      'terminnr', 'terminkode', 'arstall'):
                u_attr[k] = u[k]
            student_cols, student = _ext_cols(fs.undervisning.list_studenter_underv_enhet(**u_attr))
            for s in student:
                s_attr = u_attr.copy()
                for k in ('fodselsdato', 'personnr'):
                    s_attr[k] = s[k]
                f.write(xml.xmlify_dbrow({}, (), 'student',
                                         extra_attr=s_attr)
                        + "\n")
    f.write("</data>\n")
    f.close()
def write_role_info(sys_y, outfile):
    stream = MinimumSizeWriter(outfile)
    stream.min_size = 2 * KiB
    write_roles(stream, sys_y.list_roles())
    stream.close()