Sfoglia il codice sorgente

Merge pull request #661 from fghaas/custom-article-urls-fix-draft

custom_article_urls: correctly handle draft status
Justin Mayer 9 anni fa
parent
commit
d34c548cb0
1 ha cambiato i file con 6 aggiunte e 2 eliminazioni
  1. 6 2
      custom_article_urls/custom_article_urls.py

+ 6 - 2
custom_article_urls/custom_article_urls.py

@@ -27,12 +27,16 @@ def custom_url(generator, metadata):
 
         if pattern_matched:
             #only alter url if hasn't been set in the metdata
+            ignore = False
             if ('url', 'save_as') in metadata:
                 """ if both url and save_as are set in the metadata already
                 then there is already a custom url set, skip this one
                 """
-                pass
-            else:
+                ignore = True
+            elif ('status' in metadata) and (metadata['status'] == 'draft'):
+                ignore = True
+
+            if not ignore:
                 temp_article = Article("", metadata=metadata)
                 url_format = pattern_matched['URL']
                 save_as_format = pattern_matched['SAVE_AS']