The database impl was raising an exception if no parsed template exists. The logic that was looking up the parsed template expects None to be returned if the template isn't stored. * I also fixed some pep8 errors.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>