I suggest you init readonly_mode as 
```readonly_mode = ("yes" == params.get("readonly_mode", "no"))```
Then we can avoid this parsing with if and else .