Explorar o código

category_meta: Add support for Pelican >= 3.7.0

`category.slug` is not writeable since 648165b839fe9562822fa843cbdbfe224b12dfbd.
Valentin Lorentz %!s(int64=6) %!d(string=hai) anos
pai
achega
9f47d6bb84
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      category_meta/category_meta.py

+ 4 - 1
category_meta/category_meta.py

@@ -70,7 +70,10 @@ def make_category(article, slug):
 
     # Setting a category's name resets its slug, so do that first.
     category.name = article.title
-    category.slug = slug
+    try:
+        category.slug = slug
+    except AttributeError:
+        category._slug = slug
 
     # Description from article text.
     # XXX Relative URLs in the article content may not be handled correctly.