fix flickr url regex
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 2 Jul 2012 11:39:39 +0000 (13:39 +0200)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 2 Jul 2012 11:40:03 +0000 (13:40 +0200)
apps/cover/forms.py
apps/cover/templates/cover/flickr.html [deleted file]

index fab0bb6..fdd4304 100755 (executable)
@@ -38,7 +38,7 @@ class FlickrForm(forms.Form):
 
     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')
diff --git a/apps/cover/templates/cover/flickr.html b/apps/cover/templates/cover/flickr.html
deleted file mode 100644 (file)
index fcff1c5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-{% extends "catalogue/base.html" %}
-
-
-{% block content %}
-<h1>Flickr</h1>
-
-<form method="post">
-{% csrf_token %}
-URL: <input size="50" placeholder="np. http://www.flickr.com/photos/abcdef/1234567890" name="flickr_url" value="{{ url }}"/>
-<input type="submit" value="Generuj metadane" />
-</form>
-
-<textarea style="width:100%" rows="5">
-&lt;dc:relation.coverImage.url xmlns:dc="http://purl.org/dc/elements/1.1/">{{ image_url }}&lt;/dc:relation.coverImage.url>
-&lt;dc:relation.coverImage.attribution xmlns:dc="http://purl.org/dc/elements/1.1/">{{ author }}@Flickr, {{ license_name }}&lt;/dc:relation.coverImage.attribution>
-&lt;dc:relation.coverImage.source xmlns:dc="http://purl.org/dc/elements/1.1/">{{ url }}&lt;/dc:relation.coverImage.source>
-</textarea>
-{% endblock %}