Fixes #1598
[redakcja.git] / apps / cover / forms.py
index 754d697..d726f1f 100755 (executable)
@@ -6,6 +6,7 @@
 import re
 from urllib2 import urlopen
 from django import forms
+from django.utils.translation import ugettext_lazy as _
 from cover.models import Image
 
 class ImageAddForm(forms.ModelForm):
@@ -33,11 +34,11 @@ class ReadonlyImageEditForm(ImageEditForm):
 
 
 class FlickrForm(forms.Form):
-    source_url = forms.URLField()
+    source_url = forms.URLField(label=_('Flickr URL'))
 
     def clean_source_url(self):
         url = self.cleaned_data['source_url']
-        m = re.match(r'(https?://)?(www.)?flickr.com/photos/(?P<author>[^/]+)/(?P<img>\d+)', url)
+        m = re.match(r'(https?://)?(www\.|secure\.)?flickr\.com/photos/(?P<author>[^/]+)/(?P<img>\d+)/?', url)
         if not m:
             raise forms.ValidationError("It doesn't look like Flickr URL.")
         author_slug, img_id = m.group('author'), m.group('img')