Пример #1
0
def __regularize_form_input(form):
    '''
    This function brings the user input to standard.
    '''
    # check fields from table person
    regularizeFormInputPersonorm(form)

    # check fields from table request
    for field in ('project', 'organization'):
        form.vars[field] = regularizeName(form.vars[field])
Пример #2
0
def __validateform(form):
    '''
    Functions that take arguments or start with a double underscore are not publicly exposed and can only be called by other functions.
    This validation function checks whether or not at least one of the help shift checkbox fields has been checked.
    Notes on donations are regularized.
    '''
    sale = form.sale
    sale.analyzecheckboxes(form.vars)
    if not (sale.b_does_help or sale.b_wants_sale_number or sale.b_does_donate):
        form.errors.msg = 'Sie haben angegeben, daß Sie weder eine Kommissionsnummer haben möchten noch helfen oder Kuchen spenden möchten. Bitte wählen Sie etwas aus!'
    elif sale.b_open_shifts_available and not sale.b_does_help and not sale.b_cannot_help and sale.b_wants_sale_number:
        form.errors.msg = 'Sie haben sich für keine Helferschicht eingetragen. Bitte bestätigen Sie, daß Sie nicht helfen können.'
    elif sale.b_does_help and sale.b_cannot_help:
        form.errors.msg = 'Sie haben widersprüchliche Angaben gemacht! Bitte tragen Sie sich entweder für eine Helferschicht ein oder markieren Sie, daß Sie nicht helfen können.'
    
    
    for donation in sale.getdonations():
        if donation.name_note in form.vars:
            form.vars[donation.name_note] = regularizeName(form.vars[donation.name_note])
Пример #3
0
def __regularize_form_input(form):
    '''
    This function brings the user input to standard.
    '''
    for field in ('forename', 'name'):
        form.vars[field] = regularizeName(form.vars[field])
Пример #4
0
    global shotdbold
    global shotdb
    
from shotlogging import logger_bg
from formutils import regularizeName

logger_bg.info('start with script "resolve_waitlist" ...')

try:
    count = 0
    for row in shotdb(shotdb.person.id > 0).select():
        count += 1
        msg = '#%d, id: %d\t%s, %s' % (count, row.id, row.name, row.forename)
        logger_bg.info(msg)
        
        new = {
               'forename' : regularizeName(row.forename),
               'name'     : regularizeName(row.name),
               'place'    : regularizeName(row.place),
               'street'   : regularizeName(row.street)
        }
    
        shotdb(shotdb.person.id == row.id).update(**new)
    
        shotdb.commit()
    
    
    logger_bg.info('all done.')
    
except Exception, e:
    logger_bg.error(str(e))