在以下代码中:
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个前变量返回空吗?我如何检查?