Would:

```
if 'appver' not in data:
    data['appver'] = request.session.get('search.appver', 'any')
```

work?