Commits

faassen committed 7cc2b2b

Get rid of more global configuration variables.

Comments (0)

Files changed (1)

 
 config = get_configuration('blaag.cfg')
 
-TITLE = config.get('content', 'title')
-AUTHOR = config.get('content', 'author')
-DESCRIPTION = config.get('content', 'description')
 ENTRIES_PATH = config.get('content', 'entries_path')
 
 TEMPLATES_PATH = config.get('html', 'templates_path')
     'python.xml': sieve('python')
     }
 
-def generate_rss(data, sieve):
+def generate_rss(data, sieve, title, description, base_url):
     """Generate the rss feed, from a list of docutils parts dicts.
     Depends on that the parts['created'] contains UTC """
     items = []
                     pubDate = datetime.fromtimestamp(parts['created'])))
 
     return PyRSS2Gen.RSS2(
-        title = TITLE,
-        link = BASE,
-        description = DESCRIPTION,
+        title = title,
+        link = base_url,
+        description = description,
         lastBuildDate = datetime.utcnow(),
         items = items)
 
 
 def generate_blaag():
     """Generate html from blaag entries."""
-    
+    html_path = config.get('html', 'html_path')
+
     setup_target_folder(
-            html_path=config.get('html', 'html_path'),
-            css_path=config.get('html', 'css_path'),
-            css_name=config.get('html', 'css_name')
-            )
+        html_path=html_path,
+        css_path=config.get('html', 'css_path'),
+        css_name=config.get('html', 'css_name')
+        )
 
     entries = get_entries()
     data = get_data_entries(entries)
                                                    title=parts['title']) 
                           for parts in data])
 
-    html_path = config.get('html', 'html_path')
-
+    title = config.get('content', 'title')
 
     defaults = {
         'disqus_name': config.get('disqus', 'name'),
         'css': config.get('html', 'css_url') + "?" + str(int(time())), #force reload. 
-        'page_title': config.get('content', 'title'),
-        'blaag_title': config.get('content', 'title'),
+        'page_title': title,
+        'blaag_title': title,
         'author': config.get('content', 'author'),
         }
 
         target.write(page_tpl.substitute(defaults, links=links, 
                                          main="\n".join(main)).encode("utf-8"))
     #Write rss
+
+    description = config.get('content', 'description')
+    base_url = config.get('html', 'base_url')
+    
     for name in FEEDS:        
-        rss = generate_rss(data, FEEDS[name])
+        rss = generate_rss(data, FEEDS[name], title, description, base_url)
         f = open(os.path.join(html_path, name), 'w')
         rss.write_xml(f)
         f.close()