From: Radek Czajka Date: Wed, 19 Feb 2014 10:35:04 +0000 (+0100) Subject: Fixing two recently introduced bugs. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/ead103592c898e7fd83ac66a452c97548d45b1ea Fixing two recently introduced bugs. --- diff --git a/apps/opds/views.py b/apps/opds/views.py index d70501c1d..33ca9dff6 100644 --- a/apps/opds/views.py +++ b/apps/opds/views.py @@ -74,13 +74,13 @@ class OPDSFeed(Atom1Feed): link_rel = u"subsection" link_type = u"application/atom+xml" - _book_parent_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book-parent.png")))() + _book_parent_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book-parent.png")), str)() try: _book_parent_img_size = unicode(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book-parent.png"))) except: _book_parent_img_size = '' - _book_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book.png")))() + _book_img = lazy(lambda: full_url(os.path.join(settings.STATIC_URL, "img/book.png")), str)() try: _book_img_size = unicode(os.path.getsize(os.path.join(settings.STATIC_ROOT, "img/book.png"))) except: diff --git a/apps/suggest/forms.py b/apps/suggest/forms.py index 35fbaf646..b98e0ae4a 100644 --- a/apps/suggest/forms.py +++ b/apps/suggest/forms.py @@ -4,6 +4,7 @@ # from django import forms from django.contrib.sites.models import Site +from django.core.exceptions import ValidationError from django.core.mail import send_mail, mail_managers from django.core.urlresolvers import reverse from django.core.validators import validate_email @@ -41,7 +42,11 @@ Kontakt: %(contact)s 'description': description, }, fail_silently=True) - if validate_email(contact): + try: + validate_email(contact) + except ValidationError: + pass + else: send_mail(u'[WolneLektury] ' + ugettext(u'Thank you for your suggestion.'), ugettext(u"""\ @@ -96,7 +101,11 @@ Audiobooki: 'audiobooks': audiobooks, }, fail_silently=True) - if validate_email(contact): + try: + validate_email(contact) + except ValidationError: + pass + else: send_mail(u'[WolneLektury] ' + ugettext(u'Thank you for your suggestion.'), ugettext(u"""\