Drop lots of legacy code. Support Python 3.7-3.11.
[librarian.git] / src / librarian / meta / types / wluri.py
index 92c6017..367157f 100644 (file)
@@ -1,10 +1,13 @@
+# This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Wolne Lektury. See NOTICE for more information.
+#
 import re
 from .base import MetaValue
 
 
 class WLURI(MetaValue):
     """Represents a WL URI. Extracts slug from it."""
-    example = 'http://wolnelektury.pl/katalog/lektura/template/'
+    template = 'http://wolnelektury.pl/katalog/lektura/%s/'
     _re_wl_uri = re.compile(
         r'http://(www\.)?wolnelektury.pl/katalog/lektur[ay]/'
         '(?P<slug>[-a-z0-9]+)/?$'
@@ -13,12 +16,12 @@ class WLURI(MetaValue):
     def __init__(self, slug, uri=None):
         """Contructs an URI from slug.
 
-        >>> print(WLURI.from_slug('a-slug').uri)
+        >>> print(WLURI('a-slug').uri)
         http://wolnelektury.pl/katalog/lektura/a-slug/
 
         """
         if uri is None:
-            uri = 'http://wolnelektury.pl/katalog/lektura/%s/' % slug
+            uri = self.template % slug
         self.uri = uri
         return super().__init__(slug)