Ejemplo n.º 1
0
def listsCheckList(postData, listtype):
    global bs, tbl
    # Fetch potential cached version
    bs = surllib.skoleGetURL(URL_MAIN, True, False, True, postData)

    if bs.cacheage > 6.9:
        bs = surllib.skoleGetURL(URL_MAIN, True, True, True, postData)

    tbl = bs.findAll('table')[2]
    if listtype == 'V6':
        # Remove links to pictures of parents
        for a in tbl.findAll('a'):
            a.replaceWithChildren()

    tr = tbl.find('tr')
    if tr.find('h2'):
        title = tr.find('h2').text
        tr.extract()
    elif tbl.find('h2'):
        title = tbl.find('h2').text
    else:
        title = u'Kontaktoplysninger'

    msg = semail.Message('contactList', tbl)
    msg.setTitle(title)
    semail.maybeEmail(msg)
Ejemplo n.º 2
0
def skoleExamineNews(url, mid):
    bs = surllib.skoleGetURL(url, True)

    # title + main text
    title = bs.h3.text
    main = bs.findAll('table')[3].table

    # create msg
    msg = semail.Message(u'dialogue', main)
    msg.setMessageID(mid)
    msg.setTitle(title)
    msg.updatePersonDate()

    semail.maybeEmail(msg)
Ejemplo n.º 3
0
def skoleExamineNews(url, mid):
    bs = surllib.skoleGetURL(url, True)

    # title + main text
    title = bs.h3.text
    main = bs.findAll('table')[3].table

    # create msg
    msg = semail.Message(u'dialogue', main)
    msg.setMessageID(mid)
    msg.setTitle(title)
    msg.updatePersonDate()

    semail.maybeEmail(msg)
Ejemplo n.º 4
0
def skoleConfirmPersonalData(bs):
    # check that we actually have the right form

    txts = [
        u'Bekræft personoplysninger',
        u'Navn og adresse:',
        u'E-mailadresse',
        u'Fastnettelefon:',
        u'Mobiltelefon',
    ]
    e = False
    for txt in txts:
        if txt not in bs.text:
            config.log(u'Hmmm.. "%s" ikke fundet på bekræftigelsessiden...')
            e = True
    if e:
        return

    # Find first form, and first table inside the form
    f = bs.findAll('form')
    if f:
        bs = f[0]
    f = bs.findAll('table')
    if f:
        bs = f[0]

    msg = semail.Message('frontpage', bs)
    msg.setTitle(u'Bekræft personoplysninger')
    semail.maybeEmail(msg)

    # And now, click the button to confirm the details
    br = surllib.getBrowser()
    fs = list(br.forms())

    if len(fs) == 1 and fs[0].name == 'FrontPage_Form1':
        # we have one form!
        br.select_form(fs[0].name)

        ss = bs.findAll('input', type='submit')
        if len(ss) == 1 and ss[0]['value'] == TEXT_I_CONFIRM:
            config.log(u'Bekræfter personlige data')
            br.submit()  # click submit!
            return

    # something went wront above
    config.log(u'Hmmm.. "%s" ikke fundet på Bekræftigelsessiden...')
Ejemplo n.º 5
0
def skoleConfirmPersonalData(bs):
    # check that we actually have the right form

    txts = [
        u'Bekræft personoplysninger',
        u'Navn og adresse:',
        u'E-mailadresse',
        u'Fastnettelefon:',
        u'Mobiltelefon',
    ]
    e = False
    for txt in txts:
        if txt not in bs.text:
            config.log(u'Hmmm.. "%s" ikke fundet på bekræftigelsessiden...')
            e = True
    if e:
        return

    # Find first form, and first table inside the form
    f = bs.findAll('form')
    if f:
        bs = f[0]
    f = bs.findAll('table')
    if f:
        bs = f[0]

    msg = semail.Message('frontpage', bs)
    msg.setTitle(u'Bekræft personoplysninger')
    semail.maybeEmail(msg)

    # And now, click the button to confirm the details
    br = surllib.getBrowser()
    fs = list(br.forms())

    if len(fs) == 1 and fs[0].name == 'FrontPage_Form1':
        # we have one form!
        br.select_form(fs[0].name)

        ss = bs.findAll('input', type='submit')
        if len(ss) == 1 and ss[0]['value'] == TEXT_I_CONFIRM:
            config.log(u'Bekræfter personlige data')
            br.submit()  # click submit!
            return

    # something went wront above
    config.log(u'Hmmm.. "%s" ikke fundet på Bekræftigelsessiden...')
Ejemplo n.º 6
0
def skoleFrontBBB(phtml):
    msg = semail.Message('frontpage', phtml)
    txt = phtml.renderContents().decode('utf-8')
    txt = re.sub('<.*?>', ' ', txt)
    txt = re.sub('[ \n\t]+', ' ', txt)

    if u'har fødselsdag i dag' in txt and 'Skrevet af' not in txt:
        # somebody's birthday
        msg.setTitle(txt)
        msg.setSender(txt.split(u' har ')[0].strip())
    else:
        txt = re.sub('<.*?>', ' ', txt)
        txt = re.sub('[ \n\t]+', ' ', txt)
        msg.setTitle(' '.join(txt.split()), True)
        msg.updatePersonDate()

    semail.maybeEmail(msg)
Ejemplo n.º 7
0
def skoleFrontBBB(phtml):
    msg = semail.Message('frontpage', phtml)
    txt = phtml.renderContents().decode('utf-8')
    txt = re.sub('<.*?>', ' ', txt)
    txt = re.sub('[ \n\t]+', ' ', txt)

    if u'har fødselsdag i dag' in txt and 'Skrevet af' not in txt:
        # somebody's birthday
        msg.setTitle(txt)
        msg.setSender(txt.split(u' har ')[0].strip())
    else:
        txt = re.sub('<.*?>', ' ', txt)
        txt = re.sub('[ \n\t]+', ' ', txt)
        msg.setTitle(' '.join(txt.split()), True)
        msg.updatePersonDate()

    semail.maybeEmail(msg)
Ejemplo n.º 8
0
def skoleFrontBBB(phtml):
    msg = semail.Message('frontpage', phtml)
    [styletag.replaceWith('') for styletag in phtml.findAll('style')]
    txt = phtml.renderContents().decode('utf-8')
    txt = re.sub('<.*?>', ' ', txt)
    txt = re.sub('[ \n\t]+', ' ', txt)

    if u'har fødselsdag' in txt and u'Skrevet af' not in txt:
        # somebody's birthday
        msg.setTitle(txt)
        msg.setSender(txt.split(u' har ')[0].strip())
        msg.setDate(time.strftime('%d-%m-%Y'))
    else:
        txt = re.sub('<.*?>', ' ', txt)
        txt = re.sub('[ \n\t]+', ' ', txt)
        msg.setTitle(' '.join(txt.split()), True)
        msg.updatePersonDate()

    semail.maybeEmail(msg)
Ejemplo n.º 9
0
def skoleFrontBBB(phtml):
    msg = semail.Message('frontpage', phtml)
    [styletag.replaceWith('') for styletag in phtml.findAll('style')]
    txt = phtml.renderContents().decode('utf-8')
    txt = re.sub('<.*?>', ' ', txt)
    txt = re.sub('[ \n\t]+', ' ', txt)

    if u'har fødselsdag' in txt and u'Skrevet af' not in txt:
        # somebody's birthday
        msg.setTitle(txt)
        msg.setSender(txt.split(u' har ')[0].strip())
        msg.setDate(time.strftime('%d-%m-%Y'))
    else:
        txt = re.sub('<.*?>', ' ', txt)
        txt = re.sub('[ \n\t]+', ' ', txt)
        msg.setTitle(' '.join(txt.split()), True)
        msg.updatePersonDate()

    semail.maybeEmail(msg)
Ejemplo n.º 10
0
def skoleCoverPic(phtml):
    msg = semail.Message('frontpage', phtml)
    msg.setTitle(u'Nyt forsidebillede')
    msg.updatePersonDate()
    semail.maybeEmail(msg)
Ejemplo n.º 11
0
def skoleOtherStuff(title, phtml):
    # some part of the frontpage, e.g., weekly schedule
    msg = semail.Message('frontpage', phtml)
    msg.setTitle(title)
    semail.maybeEmail(msg)
Ejemplo n.º 12
0
def skoleCoverPic(phtml):
    msg = semail.Message('frontpage', phtml)
    msg.setTitle(u'Nyt forsidebillede')
    msg.updatePersonDate()
    semail.maybeEmail(msg)
Ejemplo n.º 13
0
def skoleOtherStuff(title, phtml):
    # some part of the frontpage, e.g., weekly schedule
    msg = semail.Message('frontpage', phtml)
    msg.setTitle(title)
    semail.maybeEmail(msg)