Uses try/except to catch ValueError

Signed-off-by: Martin Koistinen <mkoistinen@gmail.com>
Merge pull request #2792 from mkoistinen/fix_value_error_in_pageadmin

Uses try/except to catch ValueError