Better logging, retention of feed info, concatenation of template list
This commit is contained in:
parent
33e669b3fa
commit
b1dd3a33af
@ -149,11 +149,14 @@ def load(config_file):
|
||||
config.template_directories()]
|
||||
|
||||
# merge configurations, allowing current one to override theme
|
||||
template_files = config.template_files()
|
||||
parser.read(config_file)
|
||||
for file in config.bill_of_materials():
|
||||
if not file in bom: bom.append(file)
|
||||
parser.set('Planet', 'bill_of_materials', ' '.join(bom))
|
||||
parser.set('Planet', 'template_directories', ' '.join(dirs))
|
||||
parser.set('Planet', 'template_files',
|
||||
' '.join(template_files + config.template_files()))
|
||||
break
|
||||
else:
|
||||
log.error('Unable to find theme %s', theme)
|
||||
|
@ -2,6 +2,8 @@ import planet
|
||||
import os
|
||||
import sys
|
||||
|
||||
logged_modes = []
|
||||
|
||||
def run(template_file, doc, mode='template'):
|
||||
""" select a template module based on file extension and execute it """
|
||||
log = planet.getLogger(planet.config.log_level())
|
||||
@ -16,7 +18,14 @@ def run(template_file, doc, mode='template'):
|
||||
template_resolved = os.path.join(template_dir, template_file)
|
||||
if os.path.exists(template_resolved): break
|
||||
else:
|
||||
return log.error("Unable to locate %s %s", mode, template_file)
|
||||
log.error("Unable to locate %s %s", mode, template_file)
|
||||
if not mode in logged_modes:
|
||||
log.info("%s search path:", mode)
|
||||
for template_dir in dirs:
|
||||
log.info(" %s", os.path.realpath(template_dir))
|
||||
logged_modes.append(mode)
|
||||
return
|
||||
template_resolved = os.path.realpath(template_resolved)
|
||||
|
||||
# Add shell directory to the path, if not already there
|
||||
shellpath = os.path.join(sys.path[0],'planet','shell')
|
||||
@ -34,13 +43,11 @@ def run(template_file, doc, mode='template'):
|
||||
|
||||
# Execute the shell module
|
||||
options = planet.config.template_options(template_file)
|
||||
log.debug("Processing %s %s using %s", mode,
|
||||
os.path.realpath(template_resolved), module_name)
|
||||
if mode == 'filter':
|
||||
log.debug("Processing filer %s using %s", template_resolved,
|
||||
module_name)
|
||||
return module.run(template_resolved, doc, None, options)
|
||||
else:
|
||||
log.info("Processing template %s using %s", template_resolved,
|
||||
module_name)
|
||||
output_dir = planet.config.output_dir()
|
||||
output_file = os.path.join(output_dir, base)
|
||||
module.run(template_resolved, doc, output_file, options)
|
||||
|
@ -116,6 +116,9 @@ def spiderFeed(feed):
|
||||
data = feedparser.parse(feed_info.feed.get('planet_http_location',feed),
|
||||
etag=feed_info.feed.get('planet_http_etag',None), modified=modified)
|
||||
|
||||
# if read failed, retain cached information
|
||||
if not data.version and feed_info.version: data.feed = feed_info.feed
|
||||
|
||||
# capture http status
|
||||
if not data.has_key("status"):
|
||||
if data.has_key("entries") and len(data.entries)>0:
|
||||
|
Loading…
Reference in New Issue
Block a user