逻辑错误或返回值错误?

时间:2018-10-02 13:42:46

标签: python-3.x flask

在以下代码中:

name = request.form.get('name')
month = request.form.get('month')
year = request.form.get('year')

try:
    if '=' not in name + month + year:
        cur.execute( '''SELECT * FROM jobs WHERE clientID = (SELECT id FROM clients WHERE name = %s) and MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY lastvisit DESC''', (name, month, year) )
    elif '=' not in name + year:
        cur.execute( '''SELECT * FROM jobs WHERE clientID = (SELECT id FROM clients WHERE name = %s) and YEAR(lastvisit) = %s ORDER BY lastvisit DESC''', (name, year) )
    elif '=' not in month + year:
        cur.execute( '''SELECT * FROM jobs WHERE MONTH(lastvisit) = %s and YEAR(lastvisit) = %s ORDER BY lastvisit DESC''', (month, year) )
    elif '=' not in year:
        cur.execute( '''SELECT * FROM jobs WHERE YEAR(lastvisit) = %s ORDER BY lastvisit ASC''', year )
    else:
        pdata = pdata + "<h2><font color=red>Πώς να γίνει αναζήτηση αφού δεν επέλεξες ούτε πελάτη ούτε μήνα ή τουλάχιστον το έτος?"
        pdata = pdata + "<meta http-equiv='REFRESH' content='5;%s'>" % url_for( 'index' )
        return pdata

我收到此错误:

TypeError: unsupported operand type(s) for +: 'NoneType' and 'NoneType'

是因为我的3个前变量返回空吗?我如何检查?

0 个答案:

没有答案