Merge in changes from DeWitt to enable this to work on OSX
This commit is contained in:
commit
671ab353cc
74
examples/planet-schmanet.ini
Normal file
74
examples/planet-schmanet.ini
Normal file
@ -0,0 +1,74 @@
|
||||
# Planet configuration file based on the 'fancy' Planet 2.0 example.
|
||||
#
|
||||
# This illustrates some of Planet's fancier features with example.
|
||||
|
||||
# Every planet needs a [Planet] section
|
||||
[Planet]
|
||||
# name: Your planet's name
|
||||
# link: Link to the main page
|
||||
# owner_name: Your name
|
||||
# owner_email: Your e-mail address
|
||||
name = Planet Schmanet
|
||||
link = http://planet.schmanet.janet/
|
||||
owner_name = Janet Weiss
|
||||
owner_email = janet@slut.sex
|
||||
|
||||
# cache_directory: Where cached feeds are stored
|
||||
# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
|
||||
# feed_timeout: number of seconds to wait for any given feed
|
||||
cache_directory = /home/rubys/planet/pscache
|
||||
log_level = DEBUG
|
||||
feed_timeout = 20
|
||||
|
||||
# output_theme: "theme" of the output
|
||||
# output_dir: Directory to place output files
|
||||
# items_per_page: How many items to put on each page
|
||||
output_theme = classic_fancy
|
||||
output_dir = /home/rubys/public_html/fancy
|
||||
items_per_page = 60
|
||||
|
||||
# Options placed in the [DEFAULT] section provide defaults for the feed
|
||||
# sections. Placing a default here means you only need to override the
|
||||
# special cases later.
|
||||
[DEFAULT]
|
||||
# Hackergotchi default size.
|
||||
# If we want to put a face alongside a feed, and it's this size, we
|
||||
# can omit these variables.
|
||||
facewidth = 65
|
||||
faceheight = 85
|
||||
|
||||
|
||||
# Any other section defines a feed to subscribe to. The section title
|
||||
# (in the []s) is the URI of the feed itself. A section can also be
|
||||
# have any of the following options:
|
||||
#
|
||||
# name: Name of the feed (defaults to the title found in the feed)
|
||||
#
|
||||
# Additionally any other option placed here will be available in
|
||||
# the template (prefixed with channel_ for the Items loop). We use
|
||||
# this trick to make the faces work -- this isn't something Planet
|
||||
# "natively" knows about. Look at fancy-examples/index.html.tmpl
|
||||
# for the flip-side of this.
|
||||
|
||||
[http://www.netsplit.com/blog/index.rss]
|
||||
name = Scott James Remnant
|
||||
face = keybuk.png
|
||||
# pick up the default facewidth and faceheight
|
||||
|
||||
[http://www.gnome.org/~jdub/blog/?flav=rss]
|
||||
name = Jeff Waugh
|
||||
face = jdub.png
|
||||
facewidth = 70
|
||||
faceheight = 74
|
||||
|
||||
[http://usefulinc.com/edd/blog/rss91]
|
||||
name = Edd Dumbill
|
||||
face = edd.png
|
||||
facewidth = 62
|
||||
faceheight = 80
|
||||
|
||||
[http://blog.clearairturbulence.org/?flav=rss]
|
||||
name = Thom May
|
||||
face = thom.png
|
||||
# pick up the default faceheight only
|
||||
facewidth = 59
|
@ -1,26 +1,35 @@
|
||||
import planet
|
||||
import os
|
||||
import sys
|
||||
|
||||
def run(template_file, doc):
|
||||
""" select a template module based on file extension and execute it """
|
||||
log = planet.getLogger(planet.config.log_level())
|
||||
|
||||
# see if the template can be located
|
||||
for template_dir in planet.config.template_directories():
|
||||
template_resolved = os.path.join(template_dir, template_file)
|
||||
if os.path.exists(template_resolved): break
|
||||
else:
|
||||
return log.error("Unable to locate template %s", template_file)
|
||||
|
||||
base,ext = os.path.splitext(os.path.basename(template_resolved))
|
||||
try:
|
||||
template_module_name = os.path.join('planet', 'shell', ext[1:])
|
||||
template_module = __import__(template_module_name)
|
||||
except ImportError, inst:
|
||||
return log.error("Skipping template '%s' after failing to load '%s': %s", template_resolved, template_module_name, inst)
|
||||
except Exception, inst:
|
||||
return log.error("Unknown exception: %s", inst)
|
||||
# Add shell directory to the path, if not already there
|
||||
shellpath = os.path.join(sys.path[0],'planet','shell')
|
||||
if shellpath not in sys.path:
|
||||
sys.path.append(shellpath)
|
||||
|
||||
log.info("Processing template %s from %s", template_resolved, template_module_name)
|
||||
# Try loading module for processing this template, based on the extension
|
||||
base,ext = os.path.splitext(os.path.basename(template_resolved))
|
||||
template_module_name = ext[1:]
|
||||
try:
|
||||
template_module = __import__(template_module_name)
|
||||
except Exception, inst:
|
||||
return log.error("Skipping template '%s' after failing to load '%s':" +
|
||||
" %s", template_resolved, template_module_name, inst)
|
||||
|
||||
# Execute the shell module
|
||||
log.info("Processing template %s using %s", template_resolved,
|
||||
template_module_name)
|
||||
output_dir = planet.config.output_dir()
|
||||
output_file = os.path.join(output_dir, base)
|
||||
template_module.run(template_resolved, doc, output_file)
|
||||
|
Loading…
x
Reference in New Issue
Block a user