I have this line: navs.append(A(' '+str(i+1)+' ',_href=self.action(args=request.args,vars={'_page':i,'_query':request.vars._query or ''}))) How do I do something like this: vars={'_page':i, if request.vars._query not None then insert this key/value pair ('_query':request.vars._query) else insert nothing } thx, -wj