Exemplo n.º 1
0
                       default='springforward.html')
    parms.add_argument('--csvfile',
                       dest='csvfile',
                       default='springforward.csv')

    # Do global setup
    globals.setup(parms)
    curs = globals.curs
    conn = globals.conn

    # See if we have the data needed to run and build the base part of the query
    if parms.basedate.upper().startswith('M'):
        basemonth = int(parms.basedate[1:])
        if not isMonthFinal(basemonth, curs):
            sys.exit(1)
        basepart = 'monthstart = "%s" AND entrytype = "M"' % getMonthStart(
            basemonth, curs)
        friendlybase = 'New Members on %s' % neaten(getMonthEnd(basemonth))
        msgdate = datetime.date(globals.today.year, basemonth + 1, 1)
        if basemonth == 12:
            msgdate = datetime.date(globals.today.year, 1, 1)
    else:
        basedate = cleandate(parms.basedate)
        if not haveDataFor(basedate, curs):
            sys.exit(1)
        basepart = 'asof = "%s"' % basedate
        msgdate = datetime.datetime.strptime(basedate, '%Y-%m-%d')
        friendlybase = 'New Members on %s' % neaten(msgdate)
    msgbase = dateAsWords(msgdate)

    # Figure out the end date and build that part of the query
    yesterday = cleandate('yesterday')
Exemplo n.º 2
0
    parms.add_argument("--finaldate", dest='finaldate', default='M6')
    parms.add_argument('--outfile', dest='outfile', default='springforward.html')
    parms.add_argument('--csvfile', dest='csvfile', default='springforward.csv')
    
    # Do global setup
    globals.setup(parms)
    curs = globals.curs
    conn = globals.conn
    

    # See if we have the data needed to run and build the base part of the query
    if parms.basedate.upper().startswith('M'):
        basemonth = int(parms.basedate[1:])
        if not isMonthFinal(basemonth, curs):
            sys.exit(1)
        basepart = 'monthstart = "%s" AND entrytype = "M"' % getMonthStart(basemonth, curs)
        friendlybase = 'New Members on %s' % neaten(getMonthEnd(basemonth))
        msgdate = datetime.date(globals.today.year, basemonth+1, 1)
        if basemonth == 12:
            msgdate = datetime.date(globals.today.year, 1, 1)
    else:
        basedate = cleandate(parms.basedate)
        if not haveDataFor(basedate, curs):
            sys.exit(1)
        basepart = 'asof = "%s"' % basedate
        msgdate = datetime.datetime.strptime(basedate, '%Y-%m-%d')
        friendlybase = 'New Members on %s' % neaten(msgdate)
    msgbase = dateAsWords(msgdate)

    # Figure out the end date and build that part of the query
    yesterday = cleandate('yesterday')