Beispiel #1
0
def search_jobs():
    if (
        (request.form["skill"] == "" and request.form["keyword"] == "")
        or request.form["zipcode"] == ""
        or request.form["age"] == ""
    ):
        flash("Please enter all fields")
    else:
        try:
            skill_ = request.form["skill"]
            if skill_ == "":
                skill_ = None
            key_ = request.form["keyword"]
            if key_ == "":
                key_ = None
            zip_ = request.form["zipcode"]
            age_ = int(request.form["age"])

            dataid = FormData.factory(skill_, key_, zip_, age_)

            session["formdata"] = dataid
        except ValueError:
            flash("Age must be a number")

    return redirect(url_for("show_entries"))
Beispiel #2
0
def get_current_data():
    '''
    Helper function to get the current FormData in this session
    Args: None
    Return: An FormData object; None if there're no current data
    '''
    formdata = None
    if 'formdata' in session:
        dataid = session['formdata']
        formdata = FormData.getData(dataid)
        if not formdata:
            flash('Session expired')
            del session['formdata']
    return formdata
Beispiel #3
0
def get_current_data():
    """
    Helper function to get the current FormData in this session
    Args: None
    Return: An FormData object; None if there're no current data
    """
    formdata = None
    if "formdata" in session:
        dataid = session["formdata"]
        formdata = FormData.getData(dataid)
        if not formdata:
            flash("Session expired")
            del session["formdata"]
    return formdata
Beispiel #4
0
def get_current_data():
    '''
    Helper function to get the current FormData in this session
    Args: None
    Return: An FormData object; None if there're no current data
    '''
    formdata = None
    if 'formdata' in session:
        dataid = session['formdata']
        formdata = FormData.getData(dataid)
        if not formdata:
            flash('Session expired')
            del session['formdata']
    return formdata
Beispiel #5
0
def search_jobs():
    if ((request.form['skill'] == '' and request.form['keyword'] == '')
            or request.form['zipcode'] == '' or request.form['age'] == ''):
        flash('Please enter all fields')
    else:
        try:
            skill_ = request.form['skill']
            if skill_ == '':
                skill_ = None
            key_ = request.form['keyword']
            if key_ == '':
                key_ = None
            zip_ = request.form['zipcode']
            age_ = int(request.form['age'])

            dataid = FormData.factory(skill_, key_, zip_, age_)

            session['formdata'] = dataid
        except ValueError:
            flash('Age must be a number')

    return redirect(url_for('show_entries'))
Beispiel #6
0
def search_jobs():
    if ((request.form['skill']=='' and request.form['keyword']=='')
            or request.form['zipcode']==''
            or request.form['age']==''):
        flash('Please enter all fields')
    else:
        try:
            skill_ = request.form['skill']
            if skill_ == '':
                skill_ = None
            key_ = request.form['keyword']
            if key_ == '':
                key_ = None
            zip_ = request.form['zipcode']
            age_ = int(request.form['age'])

            dataid = FormData.factory(skill_, key_, zip_, age_)

            session['formdata'] = dataid
        except ValueError:
            flash('Age must be a number')

    return redirect(url_for('show_entries'))