tags:

views:

152

answers:

2

I'd like to display an error from my python dict "errors" only if it exists.

% if c.errors.email:
<div class="hint_error">${c.errors.email}</div>
% endif

But I keep getting the error:

AttributeError: 'str' object has no attribute 'email'

What am I doing wrong?

+1  A: 

I think you mean to start with % if 'email' in c.errors:.

Alex Martelli
Thank you. That worked :).
ensnare
@ensnare, you're welcome!
Alex Martelli
+2  A: 

I think you mean to start with % if 'email' in c.errors:.

stan