SVN: planet: . AUTHORS INSTALL LICENCE NEWS PKG-INFO README THANKS TODO cache examples examples/atom...

deejay1 deejay1 at pld-linux.org
Wed Apr 4 17:08:45 CEST 2007


Author: deejay1
Date: Wed Apr  4 17:08:45 2007
New Revision: 8412

Added:
   planet/
   planet/AUTHORS
   planet/INSTALL
   planet/LICENCE
   planet/NEWS
   planet/PKG-INFO
   planet/README
   planet/THANKS
   planet/TODO
   planet/cache/
   planet/examples/
   planet/examples/atom.xml.tmpl
   planet/examples/basic/
   planet/examples/basic/config.ini
   planet/examples/basic/index.html.tmpl
   planet/examples/cache/
   planet/examples/cache/.empty
   planet/examples/fancy/
   planet/examples/fancy/config.ini
   planet/examples/fancy/index.html.tmpl
   planet/examples/foafroll.xml.tmpl
   planet/examples/opml.xml.tmpl
   planet/examples/output/
   planet/examples/output/images/
   planet/examples/output/images/edd.png   (contents, props changed)
   planet/examples/output/images/evolution.png   (contents, props changed)
   planet/examples/output/images/feed-icon-10x10.png   (contents, props changed)
   planet/examples/output/images/jdub.png   (contents, props changed)
   planet/examples/output/images/keybuk.png   (contents, props changed)
   planet/examples/output/images/logo.png   (contents, props changed)
   planet/examples/output/images/opml.png   (contents, props changed)
   planet/examples/output/images/planet.png   (contents, props changed)
   planet/examples/output/images/thom.png   (contents, props changed)
   planet/examples/output/planet.css
   planet/examples/rss10.xml.tmpl
   planet/examples/rss20.xml.tmpl
   planet/myfeeds/
   planet/myfeeds/cache/
   planet/myfeeds/config.ini
   planet/myfeeds/config_en.ini   (contents, props changed)
   planet/myfeeds/foafroll.xml.tmpl
   planet/myfeeds/foafroll_en.xml.tmpl
   planet/myfeeds/index.html.tmpl   (contents, props changed)
   planet/myfeeds/index.html.tmpl.patrys   (contents, props changed)
   planet/myfeeds/index_en.html.tmpl   (contents, props changed)
   planet/myfeeds/index_en.html.tmpl.patrys   (contents, props changed)
   planet/myfeeds/index_pl.html.tmpl   (contents, props changed)
   planet/myfeeds/opml.xml.tmpl
   planet/myfeeds/opml_en.xml.tmpl
   planet/myfeeds/rss10.xml.tmpl
   planet/myfeeds/rss10_en.xml.tmpl
   planet/myfeeds/rss20.xml.tmpl
   planet/myfeeds/rss20_en.xml.tmpl
   planet/myfeeds/style.css
   planet/planet/
   planet/planet-cache.py   (contents, props changed)
   planet/planet.py   (contents, props changed)
   planet/planet/__init__.py
   planet/planet/__init__.pyc   (contents, props changed)
   planet/planet/__init__.pyo   (contents, props changed)
   planet/planet/atomstyler.py
   planet/planet/cache.py
   planet/planet/cache.pyc   (contents, props changed)
   planet/planet/cache.pyo   (contents, props changed)
   planet/planet/compat_logging/
   planet/planet/compat_logging/__init__.py
   planet/planet/compat_logging/config.py
   planet/planet/compat_logging/handlers.py
   planet/planet/feedparser.py
   planet/planet/feedparser.pyc   (contents, props changed)
   planet/planet/feedparser.pyo   (contents, props changed)
   planet/planet/htmltmpl.py
   planet/planet/htmltmpl.pyc   (contents, props changed)
   planet/planet/htmltmpl.pyo   (contents, props changed)
   planet/planet/sanitize.py
   planet/planet/sanitize.pyc   (contents, props changed)
   planet/planet/sanitize.pyo   (contents, props changed)
   planet/planet/tests/
   planet/planet/tests/__init__.py
   planet/planet/tests/__init__.pyc   (contents, props changed)
   planet/planet/tests/data/
   planet/planet/tests/data/simple.tmpl
   planet/planet/tests/data/simple.tmplc   (contents, props changed)
   planet/planet/tests/data/simple2.tmpl
   planet/planet/tests/data/simple2.tmplc   (contents, props changed)
   planet/planet/tests/test_channel.py   (contents, props changed)
   planet/planet/tests/test_channel.pyc   (contents, props changed)
   planet/planet/tests/test_main.py   (contents, props changed)
   planet/planet/tests/test_main.pyc   (contents, props changed)
   planet/planet/tests/test_sanitize.py   (contents, props changed)
   planet/planet/tests/test_sanitize.pyc   (contents, props changed)
   planet/planet/tests/test_sub.py   (contents, props changed)
   planet/planet/tests/test_sub.pyc   (contents, props changed)
   planet/planet/timeoutsocket.py
   planet/planet/timeoutsocket.pyc   (contents, props changed)
   planet/runtests.py   (contents, props changed)
   planet/setup.py   (contents, props changed)
Log:
- moved to version controlled storage


Added: planet/AUTHORS
==============================================================================
--- (empty file)
+++ planet/AUTHORS	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,2 @@
+Scott James Remnant <scott at netsplit.com>
+Jeff Waugh <jdub at perkypants.org>

Added: planet/INSTALL
==============================================================================
--- (empty file)
+++ planet/INSTALL	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,151 @@
+Installing Planet
+-----------------
+
+You'll need at least Python 2.1 installed on your system, we recommend
+Python 2.3 though as there may be bugs with the earlier libraries.
+
+Everything Pythonesque Planet needs should be included in the
+distribution.
+
+ i.
+    First you'll need to extract the files into a folder somewhere.
+    I expect you've already done this, after all, you're reading this
+    file.  You can place this wherever you like, ~/planet is a good
+    choice, but so's anywhere else you prefer.
+
+ ii.
+    Make a copy of the files in the 'examples' subdirectory, and either
+    the 'basic' or 'fancy' subdirectory of it and put them wherever
+    you like; I like to use the Planet's name (so ~/planet/debian), but
+    it's really up to you.
+
+    The 'basic' index.html and associated config.ini are pretty plain
+    and boring, if you're after less documentation and more instant
+    gratification you may wish to use the 'fancy' ones instead.  You'll
+    want the stylesheet and images from the 'output' directory if you
+    use it.
+
+ iii.
+    Edit the config.ini file in this directory to taste, it's pretty
+    well documented so you shouldn't have any problems here.  Pay
+    particular attention to the 'output_dir' option, which should be
+    readable by your web server and especially the 'template_files'
+    option where you'll want to change "examples" to wherever you just
+    placed your copies.
+
+ iv.
+    Edit the various template (*.tmpl) files to taste, a complete list
+    of available variables is at the bottom of this file.
+
+ v.
+    Run it: planet.py pathto/config.ini
+
+    You'll want to add this to cron, make sure you run it from the
+    right directory.
+
+ vi.
+    Tell us about it! We'd love to link to you on planetplanet.org :-)
+
+
+Template files
+--------------
+
+The template files used are given as a space separated list in the
+'template_files' option in config.ini.  They are named ending in '.tmpl'
+which is removed to form the name of the file placed in the output
+directory.
+
+Reading through the example templates is recommended, they're designed to
+pretty much drop straight into your site with little modification
+anyway.
+
+Inside these template files, <TMPL_VAR xxx> is replaced with the content
+of the 'xxx' variable.  The variables available are:
+
+	name	....	} the value of the equivalent options
+	link	....	} from the [Planet] section of your
+	owner_name .	} Planet's config.ini file
+	owner_email	}
+
+	url	....	link with the output filename appended
+	generator ..	version of planet being used
+
+	date	....	                         { your date format
+	date_iso ...	current date and time in { ISO date format
+	date_822 ...	                         { RFC822 date format
+
+
+There are also two loops, 'Items' and 'Channels'.  All of the lines of
+the template and variable substitutions are available for each item or
+channel.  Loops are created using <TMPL_LOOP LoopName>...</TMPL_LOOP>
+and may be used as many times as you wish.
+
+The 'Channels' loop iterates all of the channels (feeds) defined in the
+configuration file, within it the following variables are available:
+
+	name	....	value of the 'name' option in config.ini, or title
+	title	....	title retreived from the channel's feed
+	tagline ....	description retreived from the channel's feed
+	link	....	link for the human-readable content (from the feed)
+	url	....	url of the channel's feed itself
+
+	Additionally the value of any other option specified in config.ini
+	for the feed, or in the [DEFAULT] section, is available as a
+	variable of the same name.
+
+	Depending on the feed, there may be a huge variety of other
+	variables may be available; the best way to find out what you
+	have is using the 'planet-cache' tool to examine your cache files.
+
+The 'Items' loop iterates all of the blog entries from all of the channels,
+you do not place it inside a 'Channels' loop.  Within it, the following
+variables are available:
+
+	id	....	unique id for this entry (sometimes just the link)
+	link	....	link to a human-readable version at the origin site
+
+	title	....	title of the entry
+	summary	....	a short "first page" summary
+	content	....	the full content of the entry
+
+	date	....	                              { your date format
+	date_iso ...	date and time of the entry in { ISO date format
+	date_822 ...                                  { RFC822 date format
+
+	If the entry takes place on a date that has no prior entry has
+	taken place on, the 'new_date' variable is set to that date.
+	This allows you to break up the page by day.
+
+	If the entry is from a different channel to the previous entry,
+	or is the first entry from this channel on this day
+	the 'new_channel' variable is set to the same value as the
+	'channel_url' variable.  This allows you to collate multiple
+	entries from the same person under the same banner.
+	
+	Additionally the value of any variable that would be defined
+	for the channel is available, with 'channel_' prepended to the
+	name (e.g. 'channel_name' and 'channel_link').
+
+	Depending on the feed, there may be a huge variety of other
+	variables may be available; the best way to find out what you
+	have is using the 'planet-cache' tool to examine your cache files.
+
+
+There are also a couple of other special things you can do in a template.
+
+ -  If you want HTML escaping applied to the value of a variable, use the
+    <TMPL_VAR xxx ESCAPE="HTML"> form.
+
+ -  If you want URI escaping applied to the value of a variable, use the
+    <TMPL_VAR xxx ESCAPE="URI"> form.
+
+ -  To only include a section of the template if the variable has a
+    non-empty value, you can use <TMPL_IF xxx>....</TMPL_IF>.  e.g.
+
+    <TMPL_IF new_date>
+    <h1><TMPL_VAR new_date></h1>
+    </TMPL_IF>
+
+    You may place a <TMPL_ELSE> within this block to specify an
+    alternative, or may use <TMPL_UNLESS xxx>...</TMPL_UNLESS> to
+    perform the opposite.

Added: planet/LICENCE
==============================================================================
--- (empty file)
+++ planet/LICENCE	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,84 @@
+Planet is released under the same licence as Python, here it is:
+
+
+A. HISTORY OF THE SOFTWARE
+==========================
+
+Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI) in the Netherlands as a successor of a language called ABC. Guido is Python's principal author, although it includes many contributions from others. The last version released from CWI was Python 1.2. In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI) in Reston, Virginia where he released several versions of the software. Python 1.6 was the last of the versions released by CNRI. In 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. Python 2.0 was the first and only release from BeOpen.com.
+
+Following the release of Python 1.6, and after Guido van Rossum left CNRI to work with commercial software developers, it became clear that the ability to use Python with software available under the GNU Public License (GPL) was very desirable. CNRI and the Free Software Foundation (FSF) interacted to develop enabling wording changes to the Python license. Python 1.6.1 is essentially the same as Python 1.6, with a few minor bug fixes, and with a different license that enables later versions to be GPL-compatible. Python 2.1 is a derivative work of Python 1.6.1, as well as of Python 2.0.
+
+After Python 2.0 was released by BeOpen.com, Guido van Rossum and the other PythonLabs developers joined Digital Creations. All intellectual property added from this point on, starting with Python 2.1 and its alpha and beta releases, is owned by the Python Software Foundation (PSF), a non-profit modeled after the Apache Software Foundation. See http://www.python.org/psf/ for more information about the PSF.
+
+Thanks to the many outside volunteers who have worked under Guido's direction to make these releases possible.
+
+B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
+===============================================================
+
+PSF LICENSE AGREEMENT
+---------------------
+
+1. This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 2.1.1 software in source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 2.1.1 alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001 Python Software Foundation; All Rights Reserved" are retained in Python 2.1.1 alone or in any derivative version prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on or incorporates Python 2.1.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 2.1.1.
+
+4. PSF is making Python 2.1.1 available to Licensee on an "AS IS" basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 2.1.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 2.1.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 2.1.1, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between PSF and Licensee. This License Agreement does not grant permission to use PSF trademarks or trade name in a trademark sense to endorse or promote products or services of Licensee, or any third party.
+
+8. By copying, installing or otherwise using Python 2.1.1, Licensee agrees to be bound by the terms and conditions of this License Agreement.
+
+BEOPEN.COM TERMS AND CONDITIONS FOR PYTHON 2.0
+----------------------------------------------
+
+BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
+
+1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization ("Licensee") accessing and otherwise using this software in source or binary form and its associated documentation ("the Software").
+
+2. Subject to the terms and conditions of this BeOpen Python License Agreement, BeOpen hereby grants Licensee a non-exclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use the Software alone or in any derivative version, provided, however, that the BeOpen Python License is retained in the Software, alone or in any derivative version prepared by Licensee.
+
+3. BeOpen is making the Software available to Licensee on an "AS IS" basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+5. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
+
+6. This License Agreement shall be governed by and interpreted in all respects by the law of the State of California, excluding conflict of law provisions. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between BeOpen and Licensee. This License Agreement does not grant permission to use BeOpen trademarks or trade names in a trademark sense to endorse or promote products or services of Licensee, or any third party. As an exception, the "BeOpen Python" logos available at http://www.pythonlabs.com/logos.html may be used according to the permissions granted on that web page.
+
+7. By copying, installing or otherwise using the software, Licensee agrees to be bound by the terms and conditions of this License Agreement.
+
+CNRI OPEN SOURCE GPL-COMPATIBLE LICENSE AGREEMENT
+-------------------------------------------------
+
+1. This LICENSE AGREEMENT is between the Corporation for National Research Initiatives, having an office at 1895 Preston White Drive, Reston, VA 20191 ("CNRI"), and the Individual or Organization ("Licensee") accessing and otherwise using Python 1.6.1 software in source or binary form and its associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement, CNRI hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python 1.6.1 alone or in any derivative version, provided, however, that CNRI's License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) 1995-2001 Corporation for National Research Initiatives; All Rights Reserved" are retained in Python 1.6.1 alone or in any derivative version prepared by Licensee. Alternately, in lieu of CNRI's License Agreement, Licensee may substitute the following text (omitting the quotes): "Python 1.6.1 is made available subject to the terms and conditions in CNRI's License Agreement. This Agreement together with Python 1.6.1 may be located on the Internet using the following unique, persistent identifier (known as a handle): 1895.22/1013. This Agreement may also be obtained from a
  proxy server on the Internet using the following URL: http://hdl.handle.net/1895.22/1013".
+
+3. In the event Licensee prepares a derivative work that is based on or incorporates Python 1.6.1 or any part thereof, and wants to make the derivative work available to others as provided herein, then Licensee hereby agrees to include in any such work a brief summary of the changes made to Python 1.6.1.
+
+4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material breach of its terms and conditions.
+
+7. This License Agreement shall be governed by the federal intellectual property law of the United States, including without limitation the federal copyright law, and, to the extent such U.S. federal law does not apply, by the law of the Commonwealth of Virginia, excluding Virginia's conflict of law provisions. Notwithstanding the foregoing, with regard to derivative works based on Python 1.6.1 that incorporate non-separable material that was previously distributed under the GNU General Public License (GPL), the law of the Commonwealth of Virginia shall govern this License Agreement only as to issues arising under or with respect to Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this License Agreement shall be deemed to create any relationship of agency, partnership, or joint venture between CNRI and Licensee. This License Agreement does not grant permission to use CNRI trademarks or trade name in a trademark sense to endorse or promote products or services of 
 Licensee, or any third party.
+
+8. By clicking on the "ACCEPT" button where indicated, or by copying, installing or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms and conditions of this License Agreement.
+
+        ACCEPT
+
+CWI PERMISSIONS STATEMENT AND DISCLAIMER
+----------------------------------------
+
+Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, The Netherlands. All rights reserved.
+
+Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of Stichting Mathematisch Centrum or CWI not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission.
+
+STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
\ No newline at end of file

Added: planet/NEWS
==============================================================================
--- (empty file)
+++ planet/NEWS	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,4 @@
+Planet 1.0
+----------
+
+ * First release!

Added: planet/PKG-INFO
==============================================================================
--- (empty file)
+++ planet/PKG-INFO	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,10 @@
+Metadata-Version: 1.0
+Name: planet
+Version: 2.0
+Summary: The Planet Feed Aggregator
+Home-page: http://www.planetplanet.org/
+Author: Planet Developers
+Author-email: devel at lists.planetplanet.org
+License: Python
+Description: UNKNOWN
+Platform: UNKNOWN

Added: planet/README
==============================================================================
--- (empty file)
+++ planet/README	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,12 @@
+Planet
+------
+
+Planet is a flexible feed aggregator. It downloads news feeds published by
+web sites and aggregates their content together into a single combined feed,
+latest news first.
+
+It uses Mark Pilgrim's Universal Feed Parser to read from RDF, RSS and Atom
+feeds; and Tomas Styblo's templating engine to output static files in any
+format you can dream up.
+
+Keywords: feed, blog, aggregator, RSS, RDF, Atom, OPML, Python

Added: planet/THANKS
==============================================================================
--- (empty file)
+++ planet/THANKS	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,18 @@
+Patches and Bug Fixes
+---------------------
+
+Chris Dolan - fixes, exclude filtering, duplicate culling
+David Edmondson - filtering
+Lucas Nussbaum - locale configuration
+David Pashley - cache code profiling and recursion fixing
+Gediminas Paulauskas - days per page
+
+
+Spycyroll Maintainers
+---------------------
+
+Vattekkat Satheesh Babu
+Richard Jones
+Garth Kidd
+Eliot Landrum
+Bryan Richard

Added: planet/TODO
==============================================================================
--- (empty file)
+++ planet/TODO	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,22 @@
+TODO
+====
+
+  * Expire feed history
+
+    The feed cache doesn't currently expire old entries, so could get
+    large quite rapidly.  We should probably have a config setting for
+    the cache expiry, the trouble is some channels might need a longer
+    or shorter one than others.
+
+  * Allow display normalisation to specified timezone
+
+    Some Planet admins would like their feed to be displayed in the local
+    timezone, instead of UTC.
+
+  * Support OPML and foaf subscriptions
+
+    This might be a bit invasive, but I want to be able to subscribe to OPML
+    and FOAF files, and see each feed as if it were subscribed individually.
+    Perhaps we can do this with a two-pass configuration scheme, first to pull
+    the static configs, second to go fetch and generate the dynamic configs.
+    The more I think about it, the less invasive it sounds. Hmm.

Added: planet/examples/atom.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/atom.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+	<title><TMPL_VAR name></title>
+	<link rel="self" href="<TMPL_VAR feed ESCAPE="HTML">"/>
+	<link href="<TMPL_VAR link ESCAPE="HTML">"/>
+	<id><TMPL_VAR feed ESCAPE="HTML"></id>
+	<updated><TMPL_VAR date_iso></updated>
+	<generator uri="http://www.planetplanet.org/"><TMPL_VAR generator ESCAPE="HTML"></generator>
+
+<TMPL_LOOP Items>
+	<entry<TMPL_IF channel_language> xml:lang="<TMPL_VAR channel_language>"</TMPL_IF>>
+		<title type="html"<TMPL_IF title_language> xml:lang="<TMPL_VAR title_language>"</TMPL_IF>><TMPL_VAR title ESCAPE="HTML"></title>
+		<link href="<TMPL_VAR link ESCAPE="HTML">"/>
+		<id><TMPL_VAR id ESCAPE="HTML"></id>
+		<updated><TMPL_VAR date_iso></updated>
+		<content type="html"<TMPL_IF content_language> xml:lang="<TMPL_VAR content_language>"</TMPL_IF>><TMPL_VAR content ESCAPE="HTML"></content>
+		<author>
+<TMPL_IF author_name>
+			<name><TMPL_VAR author_name ESCAPE="HTML"></name>
+<TMPL_IF author_email>
+			<email><TMPL_VAR author_email ESCAPE="HTML"></email>
+</TMPL_IF author_email>
+<TMPL_ELSE>
+<TMPL_IF channel_author_name>
+			<name><TMPL_VAR channel_author_name ESCAPE="HTML"></name>
+<TMPL_IF channel_author_email>
+			<email><TMPL_VAR channel_author_email ESCAPE="HTML"></email>
+</TMPL_IF channel_author_email>
+<TMPL_ELSE>
+			<name><TMPL_VAR channel_name ESCAPE="HTML"></name>
+</TMPL_IF>
+</TMPL_IF>
+			<uri><TMPL_VAR channel_link ESCAPE="HTML"></uri>
+		</author>
+		<source>
+<TMPL_IF channel_title>
+			<title type="html"><TMPL_VAR channel_title ESCAPE="HTML"></title>
+<TMPL_ELSE>
+			<title type="html"><TMPL_VAR channel_name ESCAPE="HTML"></title>
+</TMPL_IF>
+<TMPL_IF channel_subtitle>
+			<subtitle type="html"><TMPL_VAR channel_subtitle ESCAPE="HTML"></subtitle>
+</TMPL_IF>
+			<link rel="self" href="<TMPL_VAR channel_url ESCAPE="HTML">"/>
+<TMPL_IF channel_id>
+			<id><TMPL_VAR channel_id ESCAPE="HTML"></id>
+<TMPL_ELSE>
+			<id><TMPL_VAR channel_url ESCAPE="HTML"></id>
+</TMPL_IF>
+<TMPL_IF channel_updated_iso>
+			<updated><TMPL_VAR channel_updated_iso></updated>
+</TMPL_IF>
+<TMPL_IF channel_rights>
+			<rights type="html"><TMPL_VAR channel_rights ESCAPE="HTML"></rights>
+</TMPL_IF>
+		</source>
+	</entry>
+
+</TMPL_LOOP>
+</feed>

Added: planet/examples/basic/config.ini
==============================================================================
--- (empty file)
+++ planet/examples/basic/config.ini	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,88 @@
+# Planet configuration file
+
+# 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 Zog
+link = http://www.planet.zog/
+owner_name = Zig The Alien
+owner_email = zig at planet.zog
+
+# cache_directory: Where cached feeds are stored
+# new_feed_items: Number of items to take from new feeds
+# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
+cache_directory = examples/cache
+new_feed_items = 2
+log_level = DEBUG
+
+# template_files: Space-separated list of output template files
+template_files = examples/basic/index.html.tmpl examples/atom.xml.tmpl examples/rss20.xml.tmpl examples/rss10.xml.tmpl examples/opml.xml.tmpl examples/foafroll.xml.tmpl
+
+# The following provide defaults for each template:
+# output_dir: Directory to place output files
+# items_per_page: How many items to put on each page
+# days_per_page: How many complete days of posts to put on each page
+#                This is the absolute, hard limit (over the item limit)
+# date_format: strftime format for the default 'date' template variable
+# new_date_format: strftime format for the 'new_date' template variable
+# encoding: output encoding for the file, Python 2.3+ users can use the
+#           special "xml" value to output ASCII with XML character references
+# locale: locale to use for (e.g.) strings in dates, default is taken from your
+#         system. You can specify more locales separated by ':', planet will
+#         use the first available one
+output_dir = examples/output
+items_per_page = 60
+days_per_page = 0
+date_format = %B %d, %Y %I:%M %p
+new_date_format = %B %d, %Y
+encoding = utf-8
+# locale = C
+
+
+# To define a different value for a particular template you may create
+# a section with the same name as the template file's filename (as given
+# in template_files).
+#
+#     [examples/rss10.xml.tmpl]
+#     items_per_page = 30
+#     encoding = xml
+
+
+# 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).  You can
+# define defaults for these in a [DEFAULT] section, for example
+# Planet Debian uses the following to define faces:
+#
+#     [DEFAULT]
+#     facewidth = 64
+#     faceheight = 64
+#
+#     [http://www.blog.com/rss]
+#     face = foo.png
+#     faceheight = 32
+#
+# The facewidth of the defined blog defaults to 64.
+
+[http://www.netsplit.com/blog/index.rss]
+name = Scott James Remnant
+
+[http://www.gnome.org/~jdub/blog/?flav=rss]
+name = Jeff Waugh
+
+[http://usefulinc.com/edd/blog/rss91]
+name = Edd Dumbill
+
+[http://blog.clearairturbulence.org/?flav=rss]
+name = Thom May
+
+[http://www.hadess.net/diary.rss]
+name = Bastien Nocera

Added: planet/examples/basic/index.html.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/basic/index.html.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,88 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+### Planet HTML template.
+### 
+### This is intended to demonstrate and document Planet's templating
+### facilities, and at the same time provide a good base for you to
+### modify into your own design.
+### 
+### The output's a bit boring though, if you're after less documentation
+### and more instant gratification, there's an example with a much
+### prettier output in the fancy-examples/ directory of the Planet source.
+
+### Lines like this are comments, and are automatically removed by the
+### templating engine before processing.
+
+
+### Planet makes a large number of variables available for your templates.
+### See INSTALL for the complete list.  The raw value can be placed in your
+### output file using <TMPL_VAR varname>.  We'll put the name of our
+### Planet in the page title and again in an h1.
+ 
+<head>
+<title><TMPL_VAR name></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<meta name="generator" content="<TMPL_VAR generator ESCAPE="HTML">">
+</head>
+
+<body>
+<h1><TMPL_VAR name></h1>
+
+### One of the two loops available is the Channels loop.  This allows you
+### to easily create a list of subscriptions, which is exactly what we'll do
+### here.
+
+### Note that we can also expand variables inside HTML tags, but we need
+### to be cautious and HTML-escape any illegal characters using the form
+### <TMPL_VAR varname ESCAPE="HTML">
+
+<div style="float: right">
+<h2>Subscriptions</h2>
+<ul>
+<TMPL_LOOP Channels>
+<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR url ESCAPE="HTML">">(feed)</a></li>
+</TMPL_LOOP>
+</ul>
+</div>
+
+### The other loop is the Items loop, which will get iterated for each
+### news item.
+
+<TMPL_LOOP Items>
+
+### Visually distinguish articles from different days by checking for
+### the new_date flag.  This demonstrates the <TMPL_IF varname> ... </TMPL_IF>
+### check.
+
+<TMPL_IF new_date>
+<h2><TMPL_VAR new_date></h2>
+</TMPL_IF>
+
+### Group consecutive articles by the same author together by checking
+### for the new_channel flag.
+
+<TMPL_IF new_channel>
+<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
+</TMPL_IF>
+
+
+<TMPL_IF title>
+<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
+</TMPL_IF>
+<p>
+<TMPL_VAR content>
+</p>
+<p>
+<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF author>by <TMPL_VAR author> at </TMPL_IF><TMPL_VAR date></a></em>
+</p>
+</TMPL_LOOP>
+
+<hr>
+<p>
+<a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
+<em>Last updated: <TMPL_VAR date></em>
+</p>
+</body>
+
+</html>

Added: planet/examples/cache/.empty
==============================================================================

Added: planet/examples/fancy/config.ini
==============================================================================
--- (empty file)
+++ planet/examples/fancy/config.ini	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,106 @@
+# Planet configuration file
+#
+# 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 at slut.sex
+
+# cache_directory: Where cached feeds are stored
+# new_feed_items: Number of items to take from new feeds
+# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
+# feed_timeout: number of seconds to wait for any given feed
+cache_directory = examples/cache
+new_feed_items = 2
+log_level = DEBUG
+feed_timeout = 20
+
+# template_files: Space-separated list of output template files
+template_files = examples/fancy/index.html.tmpl examples/atom.xml.tmpl examples/rss20.xml.tmpl examples/rss10.xml.tmpl examples/opml.xml.tmpl examples/foafroll.xml.tmpl
+
+# The following provide defaults for each template:
+# output_dir: Directory to place output files
+# items_per_page: How many items to put on each page
+# days_per_page: How many complete days of posts to put on each page
+#                This is the absolute, hard limit (over the item limit)
+# date_format: strftime format for the default 'date' template variable
+# new_date_format: strftime format for the 'new_date' template variable
+# encoding: output encoding for the file, Python 2.3+ users can use the
+#           special "xml" value to output ASCII with XML character references
+# locale: locale to use for (e.g.) strings in dates, default is taken from your
+#         system. You can specify more locales separated by ':', planet will
+#         use the first available one
+output_dir = examples/output
+items_per_page = 60
+days_per_page = 0
+date_format = %B %d, %Y %I:%M %p
+new_date_format = %B %d, %Y
+encoding = utf-8
+# locale = C
+
+
+# To define a different value for a particular template you may create
+# a section with the same name as the template file's filename (as given
+# in template_files).
+
+# Provide no more than 7 days articles on the front page
+[examples/fancy/index.html.tmpl]
+days_per_page = 7
+
+# If non-zero, all feeds which have not been updated in the indicated
+# number of days will be marked as inactive
+activity_threshold = 0
+
+
+# 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

Added: planet/examples/fancy/index.html.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/fancy/index.html.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+
+### Fancy Planet HTML template.
+### 
+### When combined with the stylesheet and images in the output/ directory
+### of the Planet source, this gives you a much prettier result than the
+### default examples template and demonstrates how to use the config file
+### to support things like faces
+### 
+### For documentation on the more boring template elements, see
+### examples/config.ini and examples/index.html.tmpl in the Planet source.
+
+<head>
+<title><TMPL_VAR name></title>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<meta name="generator" content="<TMPL_VAR generator ESCAPE="HTML">">
+<link rel="stylesheet" href="planet.css" type="text/css">
+<TMPL_IF feedtype>
+<link rel="alternate" href="<TMPL_VAR feed ESCAPE="HTML">" title="<TMPL_VAR channel_title_plain ESCAPE="HTML">" type="application/<TMPL_VAR feedtype>+xml">
+</TMPL_IF>
+</head>
+
+<body>
+<h1><TMPL_VAR name></h1>
+
+<TMPL_LOOP Items>
+<TMPL_IF new_date>
+<TMPL_UNLESS __FIRST__>
+### End <div class="channelgroup">
+</div>
+### End <div class="daygroup">
+</div>
+</TMPL_UNLESS>
+<div class="daygroup">
+<h2><TMPL_VAR new_date></h2>
+</TMPL_IF>
+
+<TMPL_IF new_channel>
+<TMPL_UNLESS new_date>
+### End <div class="channelgroup">
+</div>
+</TMPL_UNLESS>
+<div class="channelgroup">
+
+### Planet provides template variables for *all* configuration options for
+### the channel (and defaults), even if it doesn't know about them.  We
+### exploit this here to add hackergotchi faces to our channels.  Planet
+### doesn't know about the "face", "facewidth" and "faceheight" configuration
+### variables, but makes them available to us anyway.
+
+<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title_plain ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
+<TMPL_IF channel_face>
+<img class="face" src="images/<TMPL_VAR channel_face ESCAPE="HTML">" width="<TMPL_VAR channel_facewidth ESCAPE="HTML">" height="<TMPL_VAR channel_faceheight ESCAPE="HTML">" alt="">
+</TMPL_IF>
+</TMPL_IF>
+
+
+<div class="entrygroup" id="<TMPL_VAR id>"<TMPL_IF channel_language> lang="<TMPL_VAR channel_language>"</TMPL_IF>>
+<TMPL_IF title>
+<h4<TMPL_IF title_language> lang="<TMPL_VAR title_language>"</TMPL_IF>><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
+</TMPL_IF>
+<div class="entry">
+<div class="content"<TMPL_IF content_language> lang="<TMPL_VAR content_language>"</TMPL_IF>>
+<TMPL_VAR content>
+</div>
+
+### Planet also makes available all of the information from the feed
+### that it can.  Use the 'planet-cache' tool on the cache file for
+### a particular feed to find out what additional keys it supports.
+### Comment extra fields are 'author' and 'category' which we
+### demonstrate below.
+
+<p class="date">
+<a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF author>by <TMPL_VAR author> at </TMPL_IF><TMPL_VAR date><TMPL_IF category> under <TMPL_VAR category></TMPL_IF></a>
+</p>
+</div>
+</div>
+
+<TMPL_IF __LAST__>
+### End <div class="channelgroup">
+</div>
+### End <div class="daygroup">
+</div>
+</TMPL_IF>
+</TMPL_LOOP>
+
+
+<div class="sidebar">
+<img src="images/logo.png" width="136" height="136" alt="">
+
+<h2>Subscriptions</h2>
+<ul>
+<TMPL_LOOP Channels>
+<li>
+<a href="<TMPL_VAR url ESCAPE="HTML">" title="subscribe"><img src="images/feed-icon-10x10.png" alt="(feed)"></a> <a <TMPL_IF link>href="<TMPL_VAR link ESCAPE="HTML">" </TMPL_IF><TMPL_IF message>class="message" title="<TMPL_VAR message ESCAPE="HTML">"</TMPL_IF><TMPL_UNLESS message>title="<TMPL_VAR title_plain ESCAPE="HTML">"</TMPL_UNLESS>><TMPL_VAR name></a>
+</li>
+</TMPL_LOOP>
+</ul>
+
+<p>
+<strong>Last updated:</strong><br>
+<TMPL_VAR date><br>
+<em>All times are UTC.</em><br>
+<br>
+Powered by:<br>
+<a href="http://www.planetplanet.org/"><img src="images/planet.png" width="80" height="15" alt="Planet" border="0"></a>
+</p>
+
+<p>
+<h2>Planetarium:</h2>
+<ul>
+<li><a href="http://www.planetapache.org/">Planet Apache</a></li>
+<li><a href="http://planet.debian.net/">Planet Debian</a></li>
+<li><a href="http://planet.freedesktop.org/">Planet freedesktop.org</a></li>
+<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
+<li><a href="http://planetsun.org/">Planet Sun</a></li>
+<li><a href="http://fedora.linux.duke.edu/fedorapeople/">Fedora People</a></li>
+<li><a href="http://www.planetplanet.org/">more...</a></li>
+</ul>
+</p>
+</div>
+</body>
+
+</html>

Added: planet/examples/foafroll.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/foafroll.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:rss="http://purl.org/rss/1.0/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+<foaf:Group>
+	<foaf:name><TMPL_VAR name ESCAPE="HTML"></foaf:name>
+	<foaf:homepage><TMPL_VAR link ESCAPE="HTML"></foaf:homepage>
+	<rdfs:seeAlso rdf:resource="<TMPL_VAR url ESCAPE="HTML">" />
+
+<TMPL_LOOP Channels>
+	<foaf:member>
+		<foaf:Agent>
+			<foaf:name><TMPL_VAR name ESCAPE="HTML"></foaf:name>
+			<foaf:weblog>
+				<foaf:Document rdf:about="<TMPL_VAR link ESCAPE="HTML">">
+					<dc:title><TMPL_VAR title_plain ESCAPE="HTML"></dc:title>
+					<rdfs:seeAlso>
+						<rss:channel rdf:about="<TMPL_VAR url ESCAPE="HTML">" />
+					</rdfs:seeAlso>
+				</foaf:Document>
+			</foaf:weblog>
+		</foaf:Agent>
+	</foaf:member>
+</TMPL_LOOP>
+
+</foaf:Group>
+</rdf:RDF>

Added: planet/examples/opml.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/opml.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<opml version="1.1">
+	<head>
+		<title><TMPL_VAR name ESCAPE="HTML"></title>
+		<dateModified><TMPL_VAR date_822></dateModified>
+		<ownerName><TMPL_VAR owner_name></ownerName>
+		<ownerEmail><TMPL_VAR owner_email></ownerEmail>
+	</head>
+	
+	<body>
+		<TMPL_LOOP Channels>
+		<outline type="rss" text="<TMPL_VAR name ESCAPE="HTML">" xmlUrl="<TMPL_VAR url ESCAPE="HTML">" title="<TMPL_IF title><TMPL_VAR title ESCAPE="HTML"></TMPL_IF><TMPL_UNLESS title><TMPL_VAR name ESCAPE="HTML"></TMPL_UNLESS>"<TMPL_IF channel_link> htmlUrl="<TMPL_VAR channel_link ESCAPE="HTML">"</TMPL_IF> />
+		</TMPL_LOOP>
+	</body>
+</opml>

Added: planet/examples/output/images/edd.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/evolution.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/feed-icon-10x10.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/jdub.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/keybuk.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/logo.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/opml.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/planet.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/images/thom.png
==============================================================================
Binary file. No diff available.

Added: planet/examples/output/planet.css
==============================================================================
--- (empty file)
+++ planet/examples/output/planet.css	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,146 @@
+body {
+	border-right: 1px solid black;
+	margin-right: 200px;
+
+	padding-left: 20px;
+	padding-right: 20px;
+}
+
+h1 {
+	margin-top: 0px;
+	padding-top: 20px;
+
+	font-family: "Bitstream Vera Sans", sans-serif;
+	font-weight: normal;
+	letter-spacing: -2px;
+	text-transform: lowercase;
+	text-align: right;
+
+	color: grey;
+}
+
+h2 {
+	font-family: "Bitstream Vera Sans", sans-serif;
+	font-weight: normal;
+	color: #200080;
+
+	margin-left: -20px;
+}
+
+h3 {
+	font-family: "Bitstream Vera Sans", sans-serif;
+	font-weight: normal;
+
+	background-color: #a0c0ff;
+	border: 1px solid #5080b0;
+
+	padding: 4px;
+}
+
+h3 a {
+	text-decoration: none;
+	color: inherit;
+}
+
+h4 {
+	font-family: "Bitstream Vera Sans", sans-serif;
+	font-weight: bold;
+}
+
+h4 a {
+	text-decoration: none;
+	color: inherit;
+}
+
+img.face {
+	float: right;
+	margin-top: -3em;
+}
+
+.entry {
+	margin-bottom: 2em;
+}
+
+.entry .date {
+	font-family: "Bitstream Vera Sans", sans-serif;
+	color: grey;
+}
+
+.entry .date a {
+	text-decoration: none;
+	color: inherit;
+}
+
+.sidebar {
+	position: absolute;
+	top: 0px;
+	right: 0px;
+	width: 200px;
+
+	margin-left: 0px;
+	margin-right: 0px;
+	padding-right: 0px;
+
+	padding-top: 20px;
+	padding-left: 0px;
+
+	font-family: "Bitstream Vera Sans", sans-serif;
+	font-size: 85%;
+}
+
+.sidebar h2 {
+	font-size: 110%;
+	font-weight: bold;
+	color: black;
+
+	padding-left: 5px;
+	margin-left: 0px;
+}
+
+.sidebar ul {
+	padding-left: 1em;
+	margin-left: 0px;
+
+	list-style-type: none;
+}
+
+.sidebar ul li:hover {
+	color: grey;
+}
+
+.sidebar ul li a {
+        text-decoration: none;
+}
+
+.sidebar ul li a:hover {
+        text-decoration: underline;
+}
+
+.sidebar ul li a img {
+        border: 0;
+}
+
+.sidebar p {
+	border-top: 1px solid grey;
+	margin-top: 30px;
+	padding-top: 10px;
+
+	padding-left: 5px;
+}
+
+.sidebar .message {
+    cursor: help;
+    border-bottom: 1px dashed red;
+}
+
+.sidebar a.message:hover {
+    cursor: help;
+	background-color: #ff0000;
+	color: #ffffff !important;
+	text-decoration: none !important;
+}
+
+a:hover {
+	text-decoration: underline !important;
+	color: blue !important;
+}

Added: planet/examples/rss10.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/rss10.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns="http://purl.org/rss/1.0/"
+>
+<channel rdf:about="<TMPL_VAR link ESCAPE="HTML">">
+	<title><TMPL_VAR name ESCAPE="HTML"></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<description><TMPL_VAR name ESCAPE="HTML"> - <TMPL_VAR link ESCAPE="HTML"></description>
+
+	<items>
+		<rdf:Seq>
+<TMPL_LOOP Items>
+			<rdf:li rdf:resource="<TMPL_VAR id ESCAPE="HTML">" />
+</TMPL_LOOP>
+		</rdf:Seq>
+	</items>
+</channel>
+
+<TMPL_LOOP Items>
+<item rdf:about="<TMPL_VAR id ESCAPE="HTML">">
+	<title><TMPL_VAR channel_name ESCAPE="HTML"><TMPL_IF title>: <TMPL_VAR title_plain ESCAPE="HTML"></TMPL_IF></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<TMPL_IF content>
+	<content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded>
+	</TMPL_IF>
+	<dc:date><TMPL_VAR date_iso></dc:date>
+	<TMPL_IF author_name>
+	<dc:creator><TMPL_VAR author_name></dc:creator>
+	</TMPL_IF>
+</item>
+</TMPL_LOOP>
+
+</rdf:RDF>

Added: planet/examples/rss20.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/examples/rss20.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<rss version="2.0">
+
+<channel>
+	<title><TMPL_VAR name></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<language>en</language>
+	<description><TMPL_VAR name ESCAPE="HTML"> - <TMPL_VAR link ESCAPE="HTML"></description>
+
+<TMPL_LOOP Items>
+<item>
+	<title><TMPL_VAR channel_name ESCAPE="HTML"><TMPL_IF title>: <TMPL_VAR title_plain ESCAPE="HTML"></TMPL_IF></title>
+	<guid><TMPL_VAR id ESCAPE="HTML"></guid>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<TMPL_IF content>
+	<description><TMPL_VAR content ESCAPE="HTML"></description>
+	</TMPL_IF>
+	<pubDate><TMPL_VAR date_822></pubDate>
+	<TMPL_IF author_email>
+	<TMPL_IF author_name>
+	<author><TMPL_VAR author_email> (<TMPL_VAR author_name>)</author>
+	<TMPL_ELSE>
+	<author><TMPL_VAR author_email></author>
+	</TMPL_IF>
+	</TMPL_IF>
+</item>
+</TMPL_LOOP>
+
+</channel>
+</rss>

Added: planet/myfeeds/config.ini
==============================================================================
--- (empty file)
+++ planet/myfeeds/config.ini	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,112 @@
+# Planet configuration file
+
+# 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 PLD
+link = http://planet.pld-linux.org/
+owner_name = PLD Linux Distribution
+owner_email = deejay1 at pld-linux.org
+
+# cache_directory: Where cached feeds are stored
+# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
+cache_directory = cache
+log_level = WARNING
+
+# template_files: Space-separated list of output template files
+template_files = myfeeds/index.html.tmpl myfeeds/rss20.xml.tmpl myfeeds/rss10.xml.tmpl myfeeds/opml.xml.tmpl myfeeds/foafroll.xml.tmpl
+
+# The following provide defaults for each template:
+# output_dir: Directory to place output files
+# items_per_page: How many items to put on each page
+# days_per_page: How many complete days of posts to put on each page
+#                This is the absolute, hard limit (over the item limit)
+# date_format: strftime format for the default 'date' template variable
+output_dir = /srv/http/planet
+items_per_page = 10
+days_per_page = 10
+date_format = %B %d, %Y %I:%M %p
+
+# To define a different value for a particular template you may create
+# a section with the same name as the template file's filename (as given
+# in template_files).
+#
+#     [myfeeds/rss10.xml.tmpl]
+#     items_per_page = 30
+
+
+# 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)
+# offset: Number of hours (+ or -) the feed's times tend to be out
+#
+# Additionally any other option placed here will be available in
+# the template (prefixed with channel_ for the Items loop).  You can
+# define defaults for these in a [DEFAULT] section, for example
+# Planet Debian uses the following to define faces:
+#
+#     [DEFAULT]
+#     facewidth = 64
+#     faceheight = 64
+#
+#     [http://www.blog.com/rss]
+#     face = foo.png
+#     faceheight = 32
+#
+# The facewidth of the defined blog defaults to 64.
+
+[http://www.maven.pl/?feed=rss2]
+name = Arkadiusz Miśkiewicz
+[http://djurban.blogspot.com/atom.xml]
+name = Piotr Szymański
+[http://jogger.pl/rss/content/jid/djurban@pld-linux.org/10]
+name = Piotr Szymański at jogger
+[http://princefool.blogspot.com/atom.xml]
+name = Łukasz Jernaś
+[http://jogger.pl/rss/content/jid/jajcus@jajcus.net/10]
+name = Jacek Konieczny
+[http://mmazur.jogger.pl/rss/cat/pld/content/html/20/]
+name = Mariusz Mazur
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=jpc@pld-linux.org&desc=1&full=1]
+name = Jakub Piotr CĹ‚apa
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=wolvverine@chrome.pl&desc=1&full=1]
+name = Michał Panasiewicz
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=adasi@culm.net&desc=1&full=1]
+name = Witek Kręcicki
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=dzimi@piramida.slask.pl&desc=1&full=1]
+name = Krzysztof Taraszka
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=jack@jack.eu.org&desc=1&full=1]
+name = Jarosław Kamper
+[http://www.room-303.com/blog/feed/]
+name = Patryk Zawadzki
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=pawelk@jabber.org&desc=1&full=1]
+name = Paweł Kołodziej
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=nbw@chrome.pl&desc=1&full=1]
+name = Tomasz Staniak
+[http://livejournal.com/users/aredridel/data/rss]
+name = Aredridel Stewart
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=malekith@pld-linux.org&desc=1&full=1]
+name = Michal Moskal
+[http://krzak.blogspot.com/atom.xml]
+name = Marcin KrzyĹźanowski
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=hawk@pld-linux.org&desc=1&full=1]
+name = Marcin KrĂłl
+[http://wiki.pld-freebsd.org/bin/view/Blog/WebRss]
+name = Tomasz Trojanowski
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=spider.apd@jabber.org&desc=1&full=1]
+name = Piotr Skwarna
+[http://palanthas.net/feed/]
+name = Kamil Kosiński
+# [http://planet.pld-linux.org/poldek/poldek.rss]
+# name = PLD FTP Traffic
+[http://andrzej.dopierala.name/?action=xmljournal&id=Blog]
+name = Andrzej Dopierała
+[http://jogger.pl/syndication.php?format=rss&count=10&jid=czarny@pld-linux.org&desc=1&full=1]
+name = Cezary KrzyĹźanowski
+[http://jogger.pl/rss/content/jid/shadzik@jabber.autocom.pl/10]
+name = Bartosz ĹšwiÄ
tek

Added: planet/myfeeds/config_en.ini
==============================================================================
--- (empty file)
+++ planet/myfeeds/config_en.ini	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,73 @@
+# Planet configuration file
+
+# 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 PLD
+link = http://planet.pld-linux.org/
+owner_name = PLD Linux Distribution
+owner_email = deejay1 at pld-linux.org
+
+# cache_directory: Where cached feeds are stored
+# log_level: One of DEBUG, INFO, WARNING, ERROR or CRITICAL
+cache_directory = cache
+log_level = DEBUG
+
+# template_files: Space-separated list of output template files
+template_files = myfeeds/index_en.html.tmpl myfeeds/rss20_en.xml.tmpl myfeeds/rss10_en.xml.tmpl myfeeds/opml_en.xml.tmpl myfeeds/foafroll_en.xml.tmpl
+
+# The following provide defaults for each template:
+# output_dir: Directory to place output files
+# items_per_page: How many items to put on each page
+# days_per_page: How many complete days of posts to put on each page
+#                This is the absolute, hard limit (over the item limit)
+# date_format: strftime format for the default 'date' template variable
+output_dir = /srv/http/planet
+items_per_page = 10
+days_per_page = 10
+date_format = %B %d, %Y %I:%M %p
+
+# To define a different value for a particular template you may create
+# a section with the same name as the template file's filename (as given
+# in template_files).
+#
+#     [myfeeds/rss10.xml.tmpl]
+#     items_per_page = 30
+
+
+# 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)
+# offset: Number of hours (+ or -) the feed's times tend to be out
+#
+# Additionally any other option placed here will be available in
+# the template (prefixed with channel_ for the Items loop).  You can
+# define defaults for these in a [DEFAULT] section, for example
+# Planet Debian uses the following to define faces:
+#
+#     [DEFAULT]
+#     facewidth = 64
+#     faceheight = 64
+#
+#     [http://www.blog.com/rss]
+#     face = foo.png
+#     faceheight = 32
+#
+# The facewidth of the defined blog defaults to 64.
+[http://www.maven.pl/?feed=rss2]
+name = Arkadiusz Miśkiewicz
+[http://djurban.blogspot.com/atom.xml]
+name = Piotr Szymański
+[http://princefool.blogspot.com/atom.xml]
+name = Łukasz Jernaś
+[http://livejournal.com/users/aredridel/data/rss]
+name = Aredridel Stewart
+[http://mmazur.jogger.pl/rss/cat/english/content/html/20/]
+name = Mariusz Mazur (en)
+# [http://planet.pld-linux.org/poldek/poldek.rss]
+# name = PLD FTP Traffic

Added: planet/myfeeds/foafroll.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/foafroll.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:rss="http://purl.org/rss/1.0/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+<foaf:Group>
+	<foaf:name><TMPL_VAR name></foaf:name>
+	<foaf:homepage><TMPL_VAR link ESCAPE="HTML"></foaf:homepage>
+	<rdfs:seeAlso rdf:resource="<TMPL_VAR uri ESCAPE="HTML">" />
+
+<TMPL_LOOP Channels>
+	<foaf:member>
+		<foaf:Agent>
+			<foaf:name><TMPL_VAR name></foaf:name>
+			<foaf:weblog>
+				<foaf:Document rdf:about="<TMPL_VAR link ESCAPE="HTML">">
+					<dc:title><TMPL_VAR title></dc:title>
+					<rdfs:seeAlso>
+						<rss:channel rdf:about="<TMPL_VAR uri ESCAPE="HTML">" />
+					</rdfs:seeAlso>
+				</foaf:Document>
+			</foaf:weblog>
+		</foaf:Agent>
+	</foaf:member>
+</TMPL_LOOP>
+
+</foaf:Group>
+</rdf:RDF>

Added: planet/myfeeds/foafroll_en.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/foafroll_en.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:rss="http://purl.org/rss/1.0/"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+>
+<foaf:Group>
+	<foaf:name><TMPL_VAR name></foaf:name>
+	<foaf:homepage><TMPL_VAR link ESCAPE="HTML"></foaf:homepage>
+	<rdfs:seeAlso rdf:resource="<TMPL_VAR uri ESCAPE="HTML">" />
+
+<TMPL_LOOP Channels>
+	<foaf:member>
+		<foaf:Agent>
+			<foaf:name><TMPL_VAR name></foaf:name>
+			<foaf:weblog>
+				<foaf:Document rdf:about="<TMPL_VAR link ESCAPE="HTML">">
+					<dc:title><TMPL_VAR title></dc:title>
+					<rdfs:seeAlso>
+						<rss:channel rdf:about="<TMPL_VAR uri ESCAPE="HTML">" />
+					</rdfs:seeAlso>
+				</foaf:Document>
+			</foaf:weblog>
+		</foaf:Agent>
+	</foaf:member>
+</TMPL_LOOP>
+
+</foaf:Group>
+</rdf:RDF>

Added: planet/myfeeds/index.html.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/index.html.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,85 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+	<title><TMPL_VAR name></title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<meta name="generator" content="<TMPL_VAR generator>" />
+	<link rel="stylesheet" href="planet.css" type="text/css" media="screen" />
+</head>
+<body>
+
+<div id="page">
+
+	<div id="header">
+		<h1><TMPL_VAR name></h1>
+		<div id="language">&raquo; <a href="index_en.html">show only english feeds</a></div>
+	</div>
+
+	<div id="content">
+		<TMPL_LOOP Items>
+		
+		<TMPL_IF new_date>
+		<h2><TMPL_VAR new_date></h2>
+		</TMPL_IF>
+		
+		<div class="post">
+			<div class="posttitle">
+				<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
+	
+				<TMPL_IF title>
+				<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
+				</TMPL_IF>
+			</div>
+
+			<div class="entry">
+				<TMPL_VAR content>
+			</div>
+			<p class="postmetadata graybox">
+				<a href="<TMPL_VAR link ESCAPE="HTML">">Posted<TMPL_IF creator> by <TMPL_VAR creator></TMPL_IF></a> at <TMPL_VAR date></em>
+			</p>
+		</div>
+		</TMPL_LOOP>
+	</div>
+
+	<div id="sidebar">
+		<ul>
+			<li><h2>Subscriptions</h2>
+				<ul>
+					<TMPL_LOOP Channels>
+					<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR url ESCAPE="HTML">">(feed)</a></li>
+					</TMPL_LOOP>
+				</ul>
+			</li>
+			<li><h2>Feeds</h2>
+				<ul>
+					<li><a href="rss10.xml" title="Planet PLD RSS 1.0 Feed">RSS 1.0</a></li>
+					<li><a href="rss20.xml" title="Planet PLD RSS 2.0 Feed">RSS 2.0</a></li>
+					<li><a href="foafroll.xml" title="Foafroll Feed">FOAFROLL</a></li>
+					<li><a href="opml.xml" title="OPML Feed">OPML</a></li>
+				</ul>
+			</li>
+			<li><h2>Links</h2>
+				<ul>
+				<li><a href="http://planetkde.org/">Planet KDE</a></li>
+				<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
+				<li><a href="http://go-mono.com/monologue/" title="Voices of the Mono Project">Monologue</a></li>
+				</ul>
+			</li>
+		</ul>
+	</div>
+	
+	
+	<hr>
+	<div id="footer">
+		<p><a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
+		<em>Last updated: <TMPL_VAR date></em></p>
+	</div>
+</div>
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-339185-3";
+urchinTracker();
+</script>
+</body>
+</html>

Added: planet/myfeeds/index.html.tmpl.patrys
==============================================================================
--- (empty file)
+++ planet/myfeeds/index.html.tmpl.patrys	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title><TMPL_VAR name></title>
+<meta name="generator" content="<TMPL_VAR generator>">
+<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/style.css">
+<link rel="alternate" title="Planet PLD RSS 1.0 Feed" href="http://planet.pld-linux.org/rss10.xml" type="application/rss+xml">
+<link rel="alternate" title="Planet PLD RSS 2.0 Feed" href="http://planet.pld-linux.org/rss20.xml" type="application/rss+xml">
+</head>
+
+<body>
+<h1><img src="/spioch.png" style="align: left;" alt=""><TMPL_VAR name></h1>
+<div style="float: right; "><a href="index_en.html">EN only</a></div>
+
+<div style="float: right; width: 20%;">
+<h2>Subscriptions</h2>
+<ul>
+<TMPL_LOOP Channels>
+<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR url ESCAPE="HTML">">(feed)</a></li>
+</TMPL_LOOP>
+</ul>
+<h2>Feeds</h2>
+<ul>
+<li><a href="rss10.xml" title="Planet PLD RSS 1.0 Feed">RSS 1.0</a></li>
+<li><a href="rss20.xml" title="Planet PLD RSS 2.0 Feed">RSS 2.0</a></li>
+<li><a href="foafroll.xml" title="Foafroll Feed">FOAFROLL</a></li>
+<li><a href="opml.xml" title="OPML Feed">OPML</a></li>
+</ul>
+<h2>Links</h2>
+<ul>
+<li><a href="http://browsehappy.pl/">MsnBetter ThanGoogle</a></li>
+<li><a href="http://planekde.org/">Planet KDE</a></li>
+<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
+</ul>
+</div>
+
+<div style="width: 70%;">
+<TMPL_LOOP Items>
+
+<TMPL_IF new_date>
+<h2><TMPL_VAR new_date></h2>
+</TMPL_IF>
+
+<TMPL_IF new_channel>
+<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
+</TMPL_IF>
+
+<TMPL_IF title>
+<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
+</TMPL_IF>
+<TMPL_IF content>
+<div class="note">
+<TMPL_VAR content>
+</div>
+</TMPL_IF>
+<p class="data">
+<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF creator>by <TMPL_VAR creator> at </TMPL_IF><TMPL_VAR date></a></em>
+</p>
+</TMPL_LOOP>
+
+<hr>
+<p>
+<a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
+<em>Last updated: <TMPL_VAR date></em>
+</p>
+<!-- stat.4u.pl NiE KaSoWaC -->
+<a target=_top href="http://stat.4u.pl/?planetpld"><img alt="" src="http://adstat.4u.pl/s4u.gif" border="0"></a>
+<script language="JavaScript" type="text/javascript">
+<!--
+function s4upl() { return "&amp;r=er";}
+//-->
+</script>
+<script language="JavaScript" type="text/javascript" src="http://adstat.4u.pl/s.js?planetpld"></script>
+<script language="JavaScript" type="text/javascript">
+<!--
+s4uext=s4upl();
+document.write('<img alt="" src="http://stat.4u.pl/cgi-bin/s.cgi?i=planetpld'+s4uext+'" width="1" height="1">')
+//-->
+</script>
+<noscript><img alt="" src="http://stat.4u.pl/cgi-bin/s.cgi?i=planetpld&amp;r=ns" width="1" height="1"></noscript>
+<!-- stat.4u.pl KoNiEc -->
+</div>
+</body>
+
+</html>

Added: planet/myfeeds/index_en.html.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/index_en.html.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,85 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+	<title><TMPL_VAR name></title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<meta name="generator" content="<TMPL_VAR generator>" />
+	<link rel="stylesheet" href="planet.css" type="text/css" media="screen" />
+</head>
+<body>
+
+<div id="page">
+
+	<div id="header">
+		<h1><TMPL_VAR name></h1>
+		<div id="language">&raquo; <a href="index.html">show all languages</a></div>
+	</div>
+
+	<div id="content">
+		<TMPL_LOOP Items>
+		
+		<TMPL_IF new_date>
+		<h2><TMPL_VAR new_date></h2>
+		</TMPL_IF>
+		
+		<div class="post">
+			<div class="posttitle">
+				<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
+	
+				<TMPL_IF title>
+				<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
+				</TMPL_IF>
+			</div>
+
+			<div class="entry">
+				<TMPL_VAR content>
+			</div>
+			<p class="postmetadata graybox">
+				<a href="<TMPL_VAR link ESCAPE="HTML">">Posted<TMPL_IF creator> by <TMPL_VAR creator></TMPL_IF></a> at <TMPL_VAR date></em>
+			</p>
+		</div>
+		</TMPL_LOOP>
+	</div>
+
+	<div id="sidebar">
+		<ul>
+			<li><h2>Subscriptions</h2>
+				<ul>
+					<TMPL_LOOP Channels>
+					<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR url ESCAPE="HTML">">(feed)</a></li>
+					</TMPL_LOOP>
+				</ul>
+			</li>
+			<li><h2>Feeds</h2>
+				<ul>
+					<li><a href="rss10_en.xml" title="Planet PLD RSS 1.0 Feed">RSS 1.0</a></li>
+					<li><a href="rss20_en.xml" title="Planet PLD RSS 2.0 Feed">RSS 2.0</a></li>
+					<li><a href="foafroll_en.xml" title="Foafroll Feed">FOAFROLL</a></li>
+					<li><a href="opml_en.xml" title="OPML Feed">OPML</a></li>
+				</ul>
+			</li>
+			<li><h2>Links</h2>
+				<ul>
+				<li><a href="http://planetkde.org/">Planet KDE</a></li>
+				<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
+				<li><a href="http://go-mono.com/monologue/" title="Voices of the Mono Project">Monologue</a></li>
+				</ul>
+			</li>
+		</ul>
+	</div>
+	
+	
+	<hr>
+	<div id="footer">
+		<p><a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
+		<em>Last updated: <TMPL_VAR date></em></p>
+	</div>
+</div>
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-339185-3";
+urchinTracker();
+</script>
+</body>
+</html>

Added: planet/myfeeds/index_en.html.tmpl.patrys
==============================================================================
--- (empty file)
+++ planet/myfeeds/index_en.html.tmpl.patrys	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title><TMPL_VAR name></title>
+<meta name="generator" content="<TMPL_VAR generator>">
+<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/style.css">
+<link rel="alternate" title="Planet PLD RSS 1.0 Feed" href="http://planet.pld-linux.org/rss10_en.xml" type="application/rss+xml">
+<link rel="alternate" title="Planet PLD RSS 2.0 Feed" href="http://planet.pld-linux.org/rss20_en.xml" type="application/rss+xml">
+</head>
+
+<body>
+<h1><img src="/spioch.png" style="align: left;" alt=""><TMPL_VAR name></h1>
+<div style="float: right; "><a href="/index.html">All languages</a></div>
+
+<div style="float: right; width: 20%;">
+<h2>Subscriptions</h2>
+<ul>
+<TMPL_LOOP Channels>
+<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR url ESCAPE="HTML">">(feed)</a></li>
+</TMPL_LOOP>
+</ul>
+<h2>Feeds</h2>                                                                                                 
+<ul>                                                                                                           
+<li><a href="rss10_en.xml" title="Planet PLD RSS 1.0 Feed">RSS 1.0</a></li>                                       
+<li><a href="rss20_en.xml" title="Planet PLD RSS 2.0 Feed">RSS 2.0</a></li>                                       
+<li><a href="foafroll_en.xml" title="Foafroll Feed">FOAFROLL</a></li>                                             
+<li><a href="opml_en.xml" title="OPML Feed">OPML</a></li>                                                         
+</ul>
+</div>
+
+<div style="width: 70%;">
+<TMPL_LOOP Items>
+
+<TMPL_IF new_date>
+<h2><TMPL_VAR new_date></h2>
+</TMPL_IF>
+
+<TMPL_IF new_channel>
+<h3>
+<a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a>
+</h3>
+</TMPL_IF>
+<TMPL_IF title>
+<h4>
+<a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a>
+</h4>
+</TMPL_IF>
+<div class="note">
+<TMPL_IF content>
+<TMPL_VAR content>
+</TMPL_IF>
+</div>
+<p class="data">
+<em><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_IF creator>by <TMPL_VAR creator> at </TMPL_IF><TMPL_VAR date></a></em>
+</p>
+</TMPL_LOOP>
+
+<hr>
+<p>
+<a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
+<em>Last updated: <TMPL_VAR date></em>
+</p>
+</div>
+</body>
+
+</html>

Added: planet/myfeeds/index_pl.html.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/index_pl.html.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,84 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+<head>
+	<title><TMPL_VAR name></title>
+	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+	<meta name="generator" content="<TMPL_VAR generator>" />
+	<link rel="stylesheet" href="planet.css" type="text/css" media="screen" />
+</head>
+<body>
+
+<div id="page">
+
+	<div id="header">
+		<h1><TMPL_VAR name></h1>
+		<div id="language">&raquo; <a href="index.html">show only english feeds</a></div>
+	</div>
+
+	<div id="content">
+		<TMPL_LOOP Items>
+		
+		<TMPL_IF new_date>
+		<h2><TMPL_VAR new_date></h2>
+		</TMPL_IF>
+		
+		<div class="post">
+			<div class="posttitle">
+				<h3><a href="<TMPL_VAR channel_link ESCAPE="HTML">" title="<TMPL_VAR channel_title ESCAPE="HTML">"><TMPL_VAR channel_name></a></h3>
+	
+				<TMPL_IF title>
+				<h4><a href="<TMPL_VAR link ESCAPE="HTML">"><TMPL_VAR title></a></h4>
+				</TMPL_IF>
+			</div>
+
+			<div class="entry">
+				<TMPL_VAR content>
+			</div>
+			<p class="postmetadata graybox">
+				<a href="<TMPL_VAR link ESCAPE="HTML">">Posted<TMPL_IF creator> by <TMPL_VAR creator></TMPL_IF></a> at <TMPL_VAR date></em>
+			</p>
+		</div>
+		</TMPL_LOOP>
+	</div>
+
+	<div id="sidebar">
+		<ul>
+			<li><h2>Subscriptions</h2>
+				<ul>
+					<TMPL_LOOP Channels>
+					<li><a href="<TMPL_VAR link ESCAPE="HTML">" title="<TMPL_VAR title ESCAPE="HTML">"><TMPL_VAR name></a> <a href="<TMPL_VAR url ESCAPE="HTML">">(feed)</a></li>
+					</TMPL_LOOP>
+				</ul>
+			</li>
+			<li><h2>Feeds</h2>
+				<ul>
+					<li><a href="rss10.xml" title="Planet PLD RSS 1.0 Feed">RSS 1.0</a></li>
+					<li><a href="rss20.xml" title="Planet PLD RSS 2.0 Feed">RSS 2.0</a></li>
+					<li><a href="foafroll.xml" title="Foafroll Feed">FOAFROLL</a></li>
+					<li><a href="opml.xml" title="OPML Feed">OPML</a></li>
+				</ul>
+			</li>
+			<li><h2>Links</h2>
+				<ul>
+				<li><a href="http://planetkde.org/">Planet KDE</a></li>
+				<li><a href="http://planet.gnome.org/">Planet GNOME</a></li>
+				</ul>
+			</li>
+		</ul>
+	</div>
+	
+	
+	<hr>
+	<div id="footer">
+		<p><a href="http://www.planetplanet.org/">Powered by Planet!</a><br>
+		<em>Last updated: <TMPL_VAR date></em></p>
+	</di>
+</div>
+<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
+</script>
+<script type="text/javascript">
+_uacct = "UA-339185-3";
+urchinTracker();
+</script>
+</body>
+</html>

Added: planet/myfeeds/opml.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/opml.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<opml version="1.1">
+	<head>
+		<title><TMPL_VAR name></title>
+		<dateCreated><TMPL_VAR date_822></dateCreated>
+		<dateModified><TMPL_VAR date_822></dateModified>
+		<ownerName><TMPL_VAR owner_name></ownerName>
+		<ownerEmail><TMPL_VAR owner_email></ownerEmail>
+	</head>
+	
+	<body>
+		<TMPL_LOOP Channels>
+		<outline text="<TMPL_VAR name ESCAPE="HTML">" xmlUrl="<TMPL_VAR uri ESCAPE="HTML">"/>
+		</TMPL_LOOP>
+	</body>
+</opml>

Added: planet/myfeeds/opml_en.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/opml_en.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<opml version="1.1">
+	<head>
+		<title><TMPL_VAR name></title>
+		<dateCreated><TMPL_VAR date_822></dateCreated>
+		<dateModified><TMPL_VAR date_822></dateModified>
+		<ownerName><TMPL_VAR owner_name></ownerName>
+		<ownerEmail><TMPL_VAR owner_email></ownerEmail>
+	</head>
+	
+	<body>
+		<TMPL_LOOP Channels>
+		<outline text="<TMPL_VAR name ESCAPE="HTML">" xmlUrl="<TMPL_VAR uri ESCAPE="HTML">"/>
+		</TMPL_LOOP>
+	</body>
+</opml>

Added: planet/myfeeds/rss10.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/rss10.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns="http://purl.org/rss/1.0/"
+>
+<channel rdf:about="<TMPL_VAR link ESCAPE="HTML">">
+	<title><TMPL_VAR name></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
+
+	<items>
+		<rdf:Seq>
+<TMPL_LOOP Items>
+			<rdf:li rdf:resource="<TMPL_VAR id ESCAPE="HTML">" />
+</TMPL_LOOP>
+		</rdf:Seq>
+	</items>
+</channel>
+
+<TMPL_LOOP Items>
+<item rdf:about="<TMPL_VAR id ESCAPE="HTML">">
+	<title><TMPL_VAR channel_name><TMPL_IF title>: <TMPL_VAR title></TMPL_IF></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<TMPL_IF content>
+	<content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded>
+	</TMPL_IF>
+	<dc:date><TMPL_VAR date_iso></dc:date>
+	<TMPL_IF creator>
+	<dc:creator><TMPL_VAR creator></dc:creator>
+	</TMPL_IF>
+</item>
+</TMPL_LOOP>
+
+</rdf:RDF>

Added: planet/myfeeds/rss10_en.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/rss10_en.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<rdf:RDF
+	xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+	xmlns:dc="http://purl.org/dc/elements/1.1/"
+	xmlns:foaf="http://xmlns.com/foaf/0.1/"
+	xmlns:content="http://purl.org/rss/1.0/modules/content/"
+	xmlns="http://purl.org/rss/1.0/"
+>
+<channel rdf:about="<TMPL_VAR link ESCAPE="HTML">">
+	<title><TMPL_VAR name></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
+
+	<items>
+		<rdf:Seq>
+<TMPL_LOOP Items>
+			<rdf:li rdf:resource="<TMPL_VAR id ESCAPE="HTML">" />
+</TMPL_LOOP>
+		</rdf:Seq>
+	</items>
+</channel>
+
+<TMPL_LOOP Items>
+<item rdf:about="<TMPL_VAR id ESCAPE="HTML">">
+	<title><TMPL_VAR channel_name><TMPL_IF title>: <TMPL_VAR title></TMPL_IF></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<TMPL_IF content>
+	<content:encoded><TMPL_VAR content ESCAPE="HTML"></content:encoded>
+	</TMPL_IF>
+	<dc:date><TMPL_VAR date_iso></dc:date>
+	<TMPL_IF creator>
+	<dc:creator><TMPL_VAR creator></dc:creator>
+	</TMPL_IF>
+</item>
+</TMPL_LOOP>
+
+</rdf:RDF>

Added: planet/myfeeds/rss20.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/rss20.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
+
+<channel>
+	<title><TMPL_VAR name></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<language>pl</language>
+	<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
+
+<TMPL_LOOP Items>
+<item>
+	<title><TMPL_VAR channel_name><TMPL_IF title>: <TMPL_VAR title></TMPL_IF></title>
+	<guid><TMPL_VAR id ESCAPE="HTML"></guid>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<TMPL_IF content>
+	<description><TMPL_VAR content ESCAPE="HTML"></description>
+	</TMPL_IF>
+	<pubDate><TMPL_VAR date_822></pubDate>
+	<TMPL_IF creator>
+	<dc:creator><TMPL_VAR creator></dc:creator>
+	</TMPL_IF>
+</item>
+</TMPL_LOOP>
+
+</channel>
+</rss>

Added: planet/myfeeds/rss20_en.xml.tmpl
==============================================================================
--- (empty file)
+++ planet/myfeeds/rss20_en.xml.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
+
+<channel>
+	<title><TMPL_VAR name></title>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<language>en</language>
+	<description><TMPL_VAR name> - <TMPL_VAR link ESCAPE="HTML"></description>
+
+<TMPL_LOOP Items>
+<item>
+	<title><TMPL_VAR channel_name><TMPL_IF title>: <TMPL_VAR title></TMPL_IF></title>
+	<guid><TMPL_VAR id ESCAPE="HTML"></guid>
+	<link><TMPL_VAR link ESCAPE="HTML"></link>
+	<TMPL_IF content>
+	<description><TMPL_VAR content ESCAPE="HTML"></description>
+	</TMPL_IF>
+	<pubDate><TMPL_VAR date_822></pubDate>
+	<TMPL_IF creator>
+	<dc:creator><TMPL_VAR creator></dc:creator>
+	</TMPL_IF>
+</item>
+</TMPL_LOOP>
+
+</channel>
+</rss>

Added: planet/myfeeds/style.css
==============================================================================
--- (empty file)
+++ planet/myfeeds/style.css	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,23 @@
+html {
+	background-color: #f3efe3;
+	color: #5e5e5e;
+	font-family: Tahoma, Arial, Lucida Grande, sans-serif;
+	font-size: 0.75em;
+	line-height: 1.25em;
+}
+a {text-decoration: underline; color: #0000ff;}
+a:hover {color: #0000cc;}
+h2, h3, h4, h5, h6
+{
+	margin: 1.5em 0 0.5em 0;
+	padding: 0 0 0.3em 0;
+	color: #003dea;
+	border-bottom: 1px solid #5e5e5e;
+/* 	line-height: 1.2em; */
+}	
+
+h2 {font-size: 1.7em; border-bottom: 2px solid #5e5e5e; }
+h3 {font-size: 1.5em;}
+h4 {font-size: 1.2em;}
+h5, h6 {font-size: 1em;}
+

Added: planet/planet-cache.py
==============================================================================
--- (empty file)
+++ planet/planet-cache.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,194 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+"""Planet cache tool.
+
+"""
+
+__authors__ = [ "Scott James Remnant <scott at netsplit.com>",
+                "Jeff Waugh <jdub at perkypants.org>" ]
+__license__ = "Python"
+
+
+import os
+import sys
+import time
+import dbhash
+import ConfigParser
+
+import planet
+
+
+def usage():
+    print "Usage: planet-cache [options] CACHEFILE [ITEMID]..."
+    print
+    print "Examine and modify information in the Planet cache."
+    print
+    print "Channel Commands:"
+    print " -C, --channel     Display known information on the channel"
+    print " -L, --list        List items in the channel"
+    print " -K, --keys        List all keys found in channel items"
+    print
+    print "Item Commands (need ITEMID):"
+    print " -I, --item        Display known information about the item(s)"
+    print " -H, --hide        Mark the item(s) as hidden"
+    print " -U, --unhide      Mark the item(s) as not hidden"
+    print
+    print "Other Options:"
+    print " -h, --help        Display this help message and exit"
+    sys.exit(0)
+
+def usage_error(msg, *args):
+    print >>sys.stderr, msg, " ".join(args)
+    print >>sys.stderr, "Perhaps you need --help ?"
+    sys.exit(1)
+
+def print_keys(item, title):
+    keys = item.keys()
+    keys.sort()
+    key_len = max([ len(k) for k in keys ])
+
+    print title + ":"
+    for key in keys:
+        if item.key_type(key) == item.DATE:
+            value = time.strftime(planet.TIMEFMT_ISO, item[key])
+        else:
+            value = str(item[key])
+        print "    %-*s  %s" % (key_len, key, fit_str(value, 74 - key_len))
+
+def fit_str(string, length):
+    if len(string) <= length:
+        return string
+    else:
+        return string[:length-4] + " ..."
+
+
+if __name__ == "__main__":
+    cache_file = None
+    want_ids = 0
+    ids = []
+
+    command = None
+
+    for arg in sys.argv[1:]:
+        if arg == "-h" or arg == "--help":
+            usage()
+        elif arg == "-C" or arg == "--channel":
+            if command is not None:
+                usage_error("Only one command option may be supplied")
+            command = "channel"
+        elif arg == "-L" or arg == "--list":
+            if command is not None:
+                usage_error("Only one command option may be supplied")
+            command = "list"
+        elif arg == "-K" or arg == "--keys":
+            if command is not None:
+                usage_error("Only one command option may be supplied")
+            command = "keys"
+        elif arg == "-I" or arg == "--item":
+            if command is not None:
+                usage_error("Only one command option may be supplied")
+            command = "item"
+            want_ids = 1
+        elif arg == "-H" or arg == "--hide":
+            if command is not None:
+                usage_error("Only one command option may be supplied")
+            command = "hide"
+            want_ids = 1
+        elif arg == "-U" or arg == "--unhide":
+            if command is not None:
+                usage_error("Only one command option may be supplied")
+            command = "unhide"
+            want_ids = 1
+        elif arg.startswith("-"):
+            usage_error("Unknown option:", arg)
+        else:
+            if cache_file is None:
+                cache_file = arg
+            elif want_ids:
+                ids.append(arg)
+            else:
+                usage_error("Unexpected extra argument:", arg)
+
+    if cache_file is None:
+        usage_error("Missing expected cache filename")
+    elif want_ids and not len(ids):
+        usage_error("Missing expected entry ids")
+
+    # Open the cache file directly to get the URL it represents
+    try:
+        db = dbhash.open(cache_file)
+        url = db["url"]
+        db.close()
+    except dbhash.bsddb._db.DBError, e:
+        print >>sys.stderr, cache_file + ":", e.args[1]
+        sys.exit(1)
+    except KeyError:
+        print >>sys.stderr, cache_file + ": Probably not a cache file"
+        sys.exit(1)
+
+    # Now do it the right way :-)
+    my_planet = planet.Planet(ConfigParser.ConfigParser())
+    my_planet.cache_directory = os.path.dirname(cache_file)
+    channel = planet.Channel(my_planet, url)
+
+    for item_id in ids:
+        if not channel.has_item(item_id):
+            print >>sys.stderr, item_id + ": Not in channel"
+            sys.exit(1)
+
+    # Do the user's bidding
+    if command == "channel":
+        print_keys(channel, "Channel Keys")
+
+    elif command == "item":
+        for item_id in ids:
+            item = channel.get_item(item_id)
+            print_keys(item, "Item Keys for %s" % item_id)
+
+    elif command == "list":
+        print "Items in Channel:"
+        for item in channel.items(hidden=1, sorted=1):
+            print "    " + item.id
+            print "         " + time.strftime(planet.TIMEFMT_ISO, item.date)
+            if hasattr(item, "title"):
+                print "         " + fit_str(item.title, 70)
+            if hasattr(item, "hidden"):
+                print "         (hidden)"
+
+    elif command == "keys":
+        keys = {}
+        for item in channel.items():
+            for key in item.keys():
+                keys[key] = 1
+
+        keys = keys.keys()
+        keys.sort()
+
+        print "Keys used in Channel:"
+        for key in keys:
+            print "    " + key
+        print
+
+        print "Use --item to output values of particular items."
+
+    elif command == "hide":
+        for item_id in ids:
+            item = channel.get_item(item_id)
+            if hasattr(item, "hidden"):
+                print item_id + ": Already hidden."
+            else:
+                item.hidden = "yes"
+
+        channel.cache_write()
+        print "Done."
+
+    elif command == "unhide":
+        for item_id in ids:
+            item = channel.get_item(item_id)
+            if hasattr(item, "hidden"):
+                del(item.hidden)
+            else:
+                print item_id + ": Not hidden."
+
+        channel.cache_write()
+        print "Done."

Added: planet/planet.py
==============================================================================
--- (empty file)
+++ planet/planet.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,168 @@
+#!/usr/bin/env python
+"""The Planet aggregator.
+
+A flexible and easy-to-use aggregator for generating websites.
+
+Visit http://www.planetplanet.org/ for more information and to download
+the latest version.
+
+Requires Python 2.1, recommends 2.3.
+"""
+
+__authors__ = [ "Scott James Remnant <scott at netsplit.com>",
+                "Jeff Waugh <jdub at perkypants.org>" ]
+__license__ = "Python"
+
+
+import os
+import sys
+import time
+import locale
+import urlparse
+
+import planet
+
+from ConfigParser import ConfigParser
+
+# Default configuration file path
+CONFIG_FILE = "config.ini"
+
+# Defaults for the [Planet] config section
+PLANET_NAME = "Unconfigured Planet"
+PLANET_LINK = "Unconfigured Planet"
+PLANET_FEED = None
+OWNER_NAME  = "Anonymous Coward"
+OWNER_EMAIL = ""
+LOG_LEVEL   = "WARNING"
+FEED_TIMEOUT = 20 # seconds
+
+# Default template file list
+TEMPLATE_FILES = "examples/basic/planet.html.tmpl"
+
+
+
+def config_get(config, section, option, default=None, raw=0, vars=None):
+    """Get a value from the configuration, with a default."""
+    if config.has_option(section, option):
+        return config.get(section, option, raw=raw, vars=None)
+    else:
+        return default
+
+def main():
+    config_file = CONFIG_FILE
+    offline = 0
+    verbose = 0
+
+    for arg in sys.argv[1:]:
+        if arg == "-h" or arg == "--help":
+            print "Usage: planet [options] [CONFIGFILE]"
+            print
+            print "Options:"
+            print " -v, --verbose       DEBUG level logging during update"
+            print " -o, --offline       Update the Planet from the cache only"
+            print " -h, --help          Display this help message and exit"
+            print
+            sys.exit(0)
+        elif arg == "-v" or arg == "--verbose":
+            verbose = 1
+        elif arg == "-o" or arg == "--offline":
+            offline = 1
+        elif arg.startswith("-"):
+            print >>sys.stderr, "Unknown option:", arg
+            sys.exit(1)
+        else:
+            config_file = arg
+
+    # Read the configuration file
+    config = ConfigParser()
+    config.read(config_file)
+    if not config.has_section("Planet"):
+        print >>sys.stderr, "Configuration missing [Planet] section."
+        sys.exit(1)
+
+    # Read the [Planet] config section
+    planet_name = config_get(config, "Planet", "name",        PLANET_NAME)
+    planet_link = config_get(config, "Planet", "link",        PLANET_LINK)
+    planet_feed = config_get(config, "Planet", "feed",        PLANET_FEED)
+    owner_name  = config_get(config, "Planet", "owner_name",  OWNER_NAME)
+    owner_email = config_get(config, "Planet", "owner_email", OWNER_EMAIL)
+    if verbose:
+        log_level = "DEBUG"
+    else:
+        log_level  = config_get(config, "Planet", "log_level", LOG_LEVEL)
+    feed_timeout   = config_get(config, "Planet", "feed_timeout", FEED_TIMEOUT)
+    template_files = config_get(config, "Planet", "template_files",
+                                TEMPLATE_FILES).split(" ")
+
+    # Default feed to the first feed for which there is a template
+    if not planet_feed:
+        for template_file in template_files:
+            name = os.path.splitext(os.path.basename(template_file))[0]
+            if name.find('atom')>=0 or name.find('rss')>=0:
+                planet_feed = urlparse.urljoin(planet_link, name)
+                break
+
+    # Define locale
+    if config.has_option("Planet", "locale"):
+        # The user can specify more than one locale (separated by ":") as
+        # fallbacks.
+        locale_ok = False
+        for user_locale in config.get("Planet", "locale").split(':'):
+            user_locale = user_locale.strip()
+            try:
+                locale.setlocale(locale.LC_ALL, user_locale)
+            except locale.Error:
+                pass
+            else:
+                locale_ok = True
+                break
+        if not locale_ok:
+            print >>sys.stderr, "Unsupported locale setting."
+            sys.exit(1)
+
+    # Activate logging
+    planet.logging.basicConfig()
+    planet.logging.getLogger().setLevel(planet.logging.getLevelName(log_level))
+    log = planet.logging.getLogger("planet.runner")
+    try:
+        log.warning
+    except:
+        log.warning = log.warn
+
+    # timeoutsocket allows feedparser to time out rather than hang forever on
+    # ultra-slow servers.  Python 2.3 now has this functionality available in
+    # the standard socket library, so under 2.3 you don't need to install
+    # anything.  But you probably should anyway, because the socket module is
+    # buggy and timeoutsocket is better.
+    if feed_timeout:
+        try:
+            feed_timeout = float(feed_timeout)
+        except:
+            log.warning("Feed timeout set to invalid value '%s', skipping", feed_timeout)
+            feed_timeout = None
+
+    if feed_timeout and not offline:
+        try:
+            from planet import timeoutsocket
+            timeoutsocket.setDefaultSocketTimeout(feed_timeout)
+            log.debug("Socket timeout set to %d seconds", feed_timeout)
+        except ImportError:
+            import socket
+            if hasattr(socket, 'setdefaulttimeout'):
+                log.debug("timeoutsocket not found, using python function")
+                socket.setdefaulttimeout(feed_timeout)
+                log.debug("Socket timeout set to %d seconds", feed_timeout)
+            else:
+                log.error("Unable to set timeout to %d seconds", feed_timeout)
+
+    # run the planet
+    my_planet = planet.Planet(config)
+    my_planet.run(planet_name, planet_link, template_files, offline)
+
+    my_planet.generate_all_files(template_files, planet_name,
+        planet_link, planet_feed, owner_name, owner_email)
+
+
+if __name__ == "__main__":
+    main()
+

Added: planet/planet/__init__.py
==============================================================================
--- (empty file)
+++ planet/planet/__init__.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,953 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+"""Planet aggregator library.
+
+This package is a library for developing web sites or software that
+aggregate RSS, CDF and Atom feeds taken from elsewhere into a single,
+combined feed.
+"""
+
+__version__ = "2.0"
+__authors__ = [ "Scott James Remnant <scott at netsplit.com>",
+                "Jeff Waugh <jdub at perkypants.org>" ]
+__license__ = "Python"
+
+
+# Modules available without separate import
+import cache
+import feedparser
+import sanitize
+import htmltmpl
+import sgmllib
+try:
+    import logging
+except:
+    import compat_logging as logging
+
+# Limit the effect of "from planet import *"
+__all__ = ("cache", "feedparser", "htmltmpl", "logging",
+           "Planet", "Channel", "NewsItem")
+
+
+import os
+import md5
+import time
+import dbhash
+import re
+
+try: 
+    from xml.sax.saxutils import escape
+except:
+    def escape(data):
+        return data.replace("&","&amp;").replace(">","&gt;").replace("<","&lt;")
+
+# Version information (for generator headers)
+VERSION = ("Planet/%s +http://www.planetplanet.org" % __version__)
+
+# Default User-Agent header to send when retreiving feeds
+USER_AGENT = VERSION + " " + feedparser.USER_AGENT
+
+# Default cache directory
+CACHE_DIRECTORY = "cache"
+
+# Default number of items to display from a new feed
+NEW_FEED_ITEMS = 10
+
+# Useful common date/time formats
+TIMEFMT_ISO = "%Y-%m-%dT%H:%M:%S+00:00"
+TIMEFMT_822 = "%a, %d %b %Y %H:%M:%S +0000"
+
+
+# Log instance to use here
+log = logging.getLogger("planet")
+try:
+    log.warning
+except:
+    log.warning = log.warn
+
+# Defaults for the template file config sections
+ENCODING        = "utf-8"
+ITEMS_PER_PAGE  = 60
+DAYS_PER_PAGE   = 0
+OUTPUT_DIR      = "output"
+DATE_FORMAT     = "%B %d, %Y %I:%M %p"
+NEW_DATE_FORMAT = "%B %d, %Y"
+ACTIVITY_THRESHOLD = 0
+
+class stripHtml(sgmllib.SGMLParser):
+    "remove all tags from the data"
+    def __init__(self, data):
+        sgmllib.SGMLParser.__init__(self)
+        self.result=''
+        self.feed(data)
+        self.close()
+    def handle_data(self, data):
+        if data: self.result+=data
+
+def template_info(item, date_format):
+    """Produce a dictionary of template information."""
+    info = {}
+    for key in item.keys():
+        if item.key_type(key) == item.DATE:
+            date = item.get_as_date(key)
+            info[key] = time.strftime(date_format, date)
+            info[key + "_iso"] = time.strftime(TIMEFMT_ISO, date)
+            info[key + "_822"] = time.strftime(TIMEFMT_822, date)
+        else:
+            info[key] = item[key]
+    if 'title' in item.keys():
+        info['title_plain'] = stripHtml(info['title']).result
+
+    return info
+
+
+class Planet:
+    """A set of channels.
+
+    This class represents a set of channels for which the items will
+    be aggregated together into one combined feed.
+
+    Properties:
+        user_agent      User-Agent header to fetch feeds with.
+        cache_directory Directory to store cached channels in.
+        new_feed_items  Number of items to display from a new feed.
+        filter          A regular expression that articles must match.
+        exclude         A regular expression that articles must not match.
+    """
+    def __init__(self, config):
+        self.config = config
+
+        self._channels = []
+
+        self.user_agent = USER_AGENT
+        self.cache_directory = CACHE_DIRECTORY
+        self.new_feed_items = NEW_FEED_ITEMS
+        self.filter = None
+        self.exclude = None
+
+    def tmpl_config_get(self, template, option, default=None, raw=0, vars=None):
+        """Get a template value from the configuration, with a default."""
+        if self.config.has_option(template, option):
+            return self.config.get(template, option, raw=raw, vars=None)
+        elif self.config.has_option("Planet", option):
+            return self.config.get("Planet", option, raw=raw, vars=None)
+        else:
+            return default
+
+    def gather_channel_info(self, template_file="Planet"):
+        date_format = self.tmpl_config_get(template_file,
+                                      "date_format", DATE_FORMAT, raw=1)
+
+        activity_threshold = int(self.tmpl_config_get(template_file,
+                                            "activity_threshold",
+                                            ACTIVITY_THRESHOLD))
+
+        if activity_threshold:
+            activity_horizon = \
+                time.gmtime(time.time()-86400*activity_threshold)
+        else:
+            activity_horizon = 0
+
+        channels = {}
+        channels_list = []
+        for channel in self.channels(hidden=1):
+            channels[channel] = template_info(channel, date_format)
+            channels_list.append(channels[channel])
+
+            # identify inactive feeds
+            if activity_horizon:
+                latest = channel.items(sorted=1)
+                if len(latest)==0 or latest[0].date < activity_horizon:
+                    channels[channel]["message"] = \
+                        "no activity in %d days" % activity_threshold
+
+            # report channel level errors
+            if not channel.url_status: continue
+            status = int(channel.url_status)
+            if status == 403:
+               channels[channel]["message"] = "403: forbidden"
+            elif status == 404:
+               channels[channel]["message"] = "404: not found"
+            elif status == 408:
+               channels[channel]["message"] = "408: request timeout"
+            elif status == 410:
+               channels[channel]["message"] = "410: gone"
+            elif status == 500:
+               channels[channel]["message"] = "internal server error"
+            elif status >= 400:
+               channels[channel]["message"] = "http status %s" % status
+
+        return channels, channels_list
+
+    def gather_items_info(self, channels, template_file="Planet", channel_list=None):
+        items_list = []
+        prev_date = []
+        prev_channel = None
+
+        date_format = self.tmpl_config_get(template_file,
+                                      "date_format", DATE_FORMAT, raw=1)
+        items_per_page = int(self.tmpl_config_get(template_file,
+                                      "items_per_page", ITEMS_PER_PAGE))
+        days_per_page = int(self.tmpl_config_get(template_file,
+                                      "days_per_page", DAYS_PER_PAGE))
+        new_date_format = self.tmpl_config_get(template_file,
+                                      "new_date_format", NEW_DATE_FORMAT, raw=1)
+
+        for newsitem in self.items(max_items=items_per_page,
+                                   max_days=days_per_page,
+                                   channels=channel_list):
+            item_info = template_info(newsitem, date_format)
+            chan_info = channels[newsitem._channel]
+            for k, v in chan_info.items():
+                item_info["channel_" + k] = v
+    
+            # Check for the start of a new day
+            if prev_date[:3] != newsitem.date[:3]:
+                prev_date = newsitem.date
+                item_info["new_date"] = time.strftime(new_date_format,
+                                                      newsitem.date)
+    
+            # Check for the start of a new channel
+            if item_info.has_key("new_date") \
+                   or prev_channel != newsitem._channel:
+                prev_channel = newsitem._channel
+                item_info["new_channel"] = newsitem._channel.url
+    
+            items_list.append(item_info)
+
+        return items_list
+
+    def run(self, planet_name, planet_link, template_files, offline = False):
+        log = logging.getLogger("planet.runner")
+
+        # Create a planet
+        log.info("Loading cached data")
+        if self.config.has_option("Planet", "cache_directory"):
+            self.cache_directory = self.config.get("Planet", "cache_directory")
+        if self.config.has_option("Planet", "new_feed_items"):
+            self.new_feed_items  = int(self.config.get("Planet", "new_feed_items"))
+        self.user_agent = "%s +%s %s" % (planet_name, planet_link,
+                                              self.user_agent)
+        if self.config.has_option("Planet", "filter"):
+            self.filter = self.config.get("Planet", "filter")
+
+        # The other configuration blocks are channels to subscribe to
+        for feed_url in self.config.sections():
+            if feed_url == "Planet" or feed_url in template_files:
+                continue
+
+            # Create a channel, configure it and subscribe it
+            channel = Channel(self, feed_url)
+            self.subscribe(channel)
+
+            # Update it
+            try:
+                if not offline and not channel.url_status == '410':
+                    channel.update()
+            except KeyboardInterrupt:
+                raise
+            except:
+                log.exception("Update of <%s> failed", feed_url)
+
+    def generate_all_files(self, template_files, planet_name,
+                planet_link, planet_feed, owner_name, owner_email):
+        
+        log = logging.getLogger("planet.runner")
+        # Go-go-gadget-template
+        for template_file in template_files:
+            manager = htmltmpl.TemplateManager()
+            log.info("Processing template %s", template_file)
+            try:
+                template = manager.prepare(template_file)
+            except htmltmpl.TemplateError:
+                template = manager.prepare(os.path.basename(template_file))
+            # Read the configuration
+            output_dir = self.tmpl_config_get(template_file,
+                                         "output_dir", OUTPUT_DIR)
+            date_format = self.tmpl_config_get(template_file,
+                                          "date_format", DATE_FORMAT, raw=1)
+            encoding = self.tmpl_config_get(template_file, "encoding", ENCODING)
+        
+            # We treat each template individually
+            base = os.path.splitext(os.path.basename(template_file))[0]
+            url = os.path.join(planet_link, base)
+            output_file = os.path.join(output_dir, base)
+
+            # Gather information
+            channels, channels_list = self.gather_channel_info(template_file) 
+            items_list = self.gather_items_info(channels, template_file) 
+
+            # Gather item information
+    
+            # Process the template
+            tp = htmltmpl.TemplateProcessor(html_escape=0)
+            tp.set("Items", items_list)
+            tp.set("Channels", channels_list)
+        
+            # Generic information
+            tp.set("generator",   VERSION)
+            tp.set("name",        planet_name)
+            tp.set("link",        planet_link)
+            tp.set("owner_name",  owner_name)
+            tp.set("owner_email", owner_email)
+            tp.set("url",         url)
+        
+            if planet_feed:
+                tp.set("feed", planet_feed)
+                tp.set("feedtype", planet_feed.find('rss')>=0 and 'rss' or 'atom')
+            
+            # Update time
+            date = time.gmtime()
+            tp.set("date",        time.strftime(date_format, date))
+            tp.set("date_iso",    time.strftime(TIMEFMT_ISO, date))
+            tp.set("date_822",    time.strftime(TIMEFMT_822, date))
+
+            try:
+                log.info("Writing %s", output_file)
+                output_fd = open(output_file, "w")
+                if encoding.lower() in ("utf-8", "utf8"):
+                    # UTF-8 output is the default because we use that internally
+                    output_fd.write(tp.process(template))
+                elif encoding.lower() in ("xml", "html", "sgml"):
+                    # Magic for Python 2.3 users
+                    output = tp.process(template).decode("utf-8")
+                    output_fd.write(output.encode("ascii", "xmlcharrefreplace"))
+                else:
+                    # Must be a "known" encoding
+                    output = tp.process(template).decode("utf-8")
+                    output_fd.write(output.encode(encoding, "replace"))
+                output_fd.close()
+            except KeyboardInterrupt:
+                raise
+            except:
+                log.exception("Write of %s failed", output_file)
+
+    def channels(self, hidden=0, sorted=1):
+        """Return the list of channels."""
+        channels = []
+        for channel in self._channels:
+            if hidden or not channel.has_key("hidden"):
+                channels.append((channel.name, channel))
+
+        if sorted:
+            channels.sort()
+
+        return [ c[-1] for c in channels ]
+
+    def find_by_basename(self, basename):
+        for channel in self._channels:
+            if basename == channel.cache_basename(): return channel
+
+    def subscribe(self, channel):
+        """Subscribe the planet to the channel."""
+        self._channels.append(channel)
+
+    def unsubscribe(self, channel):
+        """Unsubscribe the planet from the channel."""
+        self._channels.remove(channel)
+
+    def items(self, hidden=0, sorted=1, max_items=0, max_days=0, channels=None):
+        """Return an optionally filtered list of items in the channel.
+
+        The filters are applied in the following order:
+
+        If hidden is true then items in hidden channels and hidden items
+        will be returned.
+
+        If sorted is true then the item list will be sorted with the newest
+        first.
+
+        If max_items is non-zero then this number of items, at most, will
+        be returned.
+
+        If max_days is non-zero then any items older than the newest by
+        this number of days won't be returned.  Requires sorted=1 to work.
+
+
+        The sharp-eyed will note that this looks a little strange code-wise,
+        it turns out that Python gets *really* slow if we try to sort the
+        actual items themselves.  Also we use mktime here, but it's ok
+        because we discard the numbers and just need them to be relatively
+        consistent between each other.
+        """
+        planet_filter_re = None
+        if self.filter:
+            planet_filter_re = re.compile(self.filter, re.I)
+        planet_exclude_re = None
+        if self.exclude:
+            planet_exclude_re = re.compile(self.exclude, re.I)
+            
+        items = []
+        seen_guids = {}
+        if not channels: channels=self.channels(hidden=hidden, sorted=0)
+        for channel in channels:
+            for item in channel._items.values():
+                if hidden or not item.has_key("hidden"):
+
+                    channel_filter_re = None
+                    if channel.filter:
+                        channel_filter_re = re.compile(channel.filter,
+                                                       re.I)
+                    channel_exclude_re = None
+                    if channel.exclude:
+                        channel_exclude_re = re.compile(channel.exclude,
+                                                        re.I)
+                    if (planet_filter_re or planet_exclude_re \
+                        or channel_filter_re or channel_exclude_re):
+                        title = ""
+                        if item.has_key("title"):
+                            title = item.title
+                        content = item.get_content("content")
+
+                    if planet_filter_re:
+                        if not (planet_filter_re.search(title) \
+                                or planet_filter_re.search(content)):
+                            continue
+
+                    if planet_exclude_re:
+                        if (planet_exclude_re.search(title) \
+                            or planet_exclude_re.search(content)):
+                            continue
+
+                    if channel_filter_re:
+                        if not (channel_filter_re.search(title) \
+                                or channel_filter_re.search(content)):
+                            continue
+
+                    if channel_exclude_re:
+                        if (channel_exclude_re.search(title) \
+                            or channel_exclude_re.search(content)):
+                            continue
+
+                    if not seen_guids.has_key(item.id):
+                        seen_guids[item.id] = 1;
+                        items.append((time.mktime(item.date), item.order, item))
+
+        # Sort the list
+        if sorted:
+            items.sort()
+            items.reverse()
+
+        # Apply max_items filter
+        if len(items) and max_items:
+            items = items[:max_items]
+
+        # Apply max_days filter
+        if len(items) and max_days:
+            max_count = 0
+            max_time = items[0][0] - max_days * 84600
+            for item in items:
+                if item[0] > max_time:
+                    max_count += 1
+                else:
+                    items = items[:max_count]
+                    break
+
+        return [ i[-1] for i in items ]
+
+class Channel(cache.CachedInfo):
+    """A list of news items.
+
+    This class represents a list of news items taken from the feed of
+    a website or other source.
+
+    Properties:
+        url             URL of the feed.
+        url_etag        E-Tag of the feed URL.
+        url_modified    Last modified time of the feed URL.
+        url_status      Last HTTP status of the feed URL.
+        hidden          Channel should be hidden (True if exists).
+        name            Name of the feed owner, or feed title.
+        next_order      Next order number to be assigned to NewsItem
+
+        updated         Correct UTC-Normalised update time of the feed.
+        last_updated    Correct UTC-Normalised time the feed was last updated.
+
+        id              An identifier the feed claims is unique (*).
+        title           One-line title (*).
+        link            Link to the original format feed (*).
+        tagline         Short description of the feed (*).
+        info            Longer description of the feed (*).
+
+        modified        Date the feed claims to have been modified (*).
+
+        author          Name of the author (*).
+        publisher       Name of the publisher (*).
+        generator       Name of the feed generator (*).
+        category        Category name (*).
+        copyright       Copyright information for humans to read (*).
+        license         Link to the licence for the content (*).
+        docs            Link to the specification of the feed format (*).
+        language        Primary language (*).
+        errorreportsto  E-Mail address to send error reports to (*).
+
+        image_url       URL of an associated image (*).
+        image_link      Link to go with the associated image (*).
+        image_title     Alternative text of the associated image (*).
+        image_width     Width of the associated image (*).
+        image_height    Height of the associated image (*).
+
+        filter          A regular expression that articles must match.
+        exclude         A regular expression that articles must not match.
+
+    Properties marked (*) will only be present if the original feed
+    contained them.  Note that the optional 'modified' date field is simply
+    a claim made by the item and parsed from the information given, 'updated'
+    (and 'last_updated') are far more reliable sources of information.
+
+    Some feeds may define additional properties to those above.
+    """
<<diff output has been trimmed to 500 lines, 454 line(s) remained.>>

Added: planet/planet/__init__.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/__init__.pyo
==============================================================================
Binary file. No diff available.

Added: planet/planet/atomstyler.py
==============================================================================
--- (empty file)
+++ planet/planet/atomstyler.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,124 @@
+from xml.dom import minidom, Node
+from urlparse import urlparse, urlunparse
+from xml.parsers.expat import ExpatError
+from htmlentitydefs import name2codepoint
+import re
+
+# select and apply an xml:base for this entry
+class relativize:
+  def __init__(self, parent):
+    self.score = {}
+    self.links = []
+    self.collect_and_tally(parent)
+    self.base = self.select_optimal_base()
+    if self.base:
+      if not parent.hasAttribute('xml:base'):
+        self.rebase(parent)
+        parent.setAttribute('xml:base', self.base)
+
+  # collect and tally cite, href and src attributes
+  def collect_and_tally(self,parent):
+    uri = None
+    if parent.hasAttribute('cite'): uri=parent.getAttribute('cite')
+    if parent.hasAttribute('href'): uri=parent.getAttribute('href')
+    if parent.hasAttribute('src'): uri=parent.getAttribute('src')
+
+    if uri:
+      parts=urlparse(uri)
+      if parts[0].lower() == 'http':
+        parts = (parts[1]+parts[2]).split('/')
+        base = None
+        for i in range(1,len(parts)):
+          base = tuple(parts[0:i])
+          self.score[base] = self.score.get(base,0) + len(base)
+        if base and base not in self.links: self.links.append(base)
+
+    for node in parent.childNodes:
+      if node.nodeType == Node.ELEMENT_NODE:
+        self.collect_and_tally(node)
+    
+  # select the xml:base with the highest score
+  def select_optimal_base(self):
+    if not self.score: return None
+    for link in self.links:
+      self.score[link] = 0
+    winner = max(self.score.values())
+    if not winner: return None
+    for key in self.score.keys():
+      if self.score[key] == winner:
+        if winner == len(key): return None
+        return urlunparse(('http', key[0], '/'.join(key[1:]), '', '', '')) + '/'
+    
+  # rewrite cite, href and src attributes using this base
+  def rebase(self,parent):
+    uri = None
+    if parent.hasAttribute('cite'): uri=parent.getAttribute('cite')
+    if parent.hasAttribute('href'): uri=parent.getAttribute('href')
+    if parent.hasAttribute('src'): uri=parent.getAttribute('src')
+    if uri and uri.startswith(self.base):
+      uri = uri[len(self.base):] or '.'
+      if parent.hasAttribute('href'): uri=parent.setAttribute('href', uri)
+      if parent.hasAttribute('src'): uri=parent.setAttribute('src', uri)
+
+    for node in parent.childNodes:
+      if node.nodeType == Node.ELEMENT_NODE:
+        self.rebase(node)
+
+# convert type="html" to type="plain" or type="xhtml" as appropriate
+def retype(parent):
+  for node in parent.childNodes:
+    if node.nodeType == Node.ELEMENT_NODE:
+
+      if node.hasAttribute('type') and node.getAttribute('type') == 'html':
+        if len(node.childNodes)==0:
+          node.removeAttribute('type')
+        elif len(node.childNodes)==1:
+
+          # replace html entity defs with utf-8
+          chunks=re.split('&(\w+);', node.childNodes[0].nodeValue)
+          for i in range(1,len(chunks),2):
+             if chunks[i] in ['amp', 'lt', 'gt', 'apos', 'quot']:
+               chunks[i] ='&' + chunks[i] +';'
+             elif chunks[i] in name2codepoint:
+               chunks[i]=unichr(name2codepoint[chunks[i]])
+             else:
+               chunks[i]='&' + chunks[i] + ';'
+          text = u"".join(chunks)
+
+          try:
+            # see if the resulting text is a well-formed XML fragment
+            div = '<div xmlns="http://www.w3.org/1999/xhtml">%s</div>'
+            data = minidom.parseString((div % text.encode('utf-8')))
+
+            if text.find('<') < 0:
+              # plain text
+              node.removeAttribute('type')
+              text = data.documentElement.childNodes[0].nodeValue
+              node.childNodes[0].replaceWholeText(text)
+
+            elif len(text) > 80:
+              # xhtml
+              node.setAttribute('type', 'xhtml')
+              node.removeChild(node.childNodes[0])
+              node.appendChild(data.documentElement)
+
+          except ExpatError:
+            # leave as html
+            pass
+
+      else:
+        # recurse
+        retype(node)
+
+  if parent.nodeName == 'entry':
+    relativize(parent)
+
+if __name__ == '__main__':
+
+  # run styler on each file mention on the command line
+  import sys
+  for feed in sys.argv[1:]:
+    doc = minidom.parse(feed)
+    doc.normalize()
+    retype(doc.documentElement)
+    open(feed,'w').write(doc.toxml('utf-8'))

Added: planet/planet/cache.py
==============================================================================
--- (empty file)
+++ planet/planet/cache.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,306 @@
+#!/usr/bin/env python
+# -*- coding: UTF-8 -*-
+"""Item cache.
+
+Between runs of Planet we need somewhere to store the feed information
+we parsed, this is so we don't lose information when a particular feed
+goes away or is too short to hold enough items.
+
+This module provides the code to handle this cache transparently enough
+that the rest of the code can take the persistance for granted.
+"""
+
+import os
+import re
+
+
+# Regular expressions to sanitise cache filenames
+re_url_scheme    = re.compile(r'^[^:]*://')
+re_slash         = re.compile(r'[?/]+')
+re_initial_cruft = re.compile(r'^[,.]*')
+re_final_cruft   = re.compile(r'[,.]*$')
+
+
+class CachedInfo:
+    """Cached information.
+
+    This class is designed to hold information that is stored in a cache
+    between instances.  It can act both as a dictionary (c['foo']) and
+    as an object (c.foo) to get and set values and supports both string
+    and date values.
+
+    If you wish to support special fields you can derive a class off this
+    and implement get_FIELD and set_FIELD functions which will be
+    automatically called.
+    """
+    STRING = "string"
+    DATE   = "date"
+    NULL   = "null"
+
+    def __init__(self, cache, id_, root=0):
+        self._type = {}
+        self._value = {}
+        self._cached = {}
+
+        self._cache = cache
+        self._id = id_.replace(" ", "%20")
+        self._root = root
+
+    def cache_key(self, key):
+        """Return the cache key name for the given key."""
+        key = key.replace(" ", "_")
+        if self._root:
+            return key
+        else:
+            return self._id + " " + key
+
+    def cache_read(self):
+        """Read information from the cache."""
+        if self._root:
+            keys_key = " keys"
+        else:
+            keys_key = self._id
+
+        if self._cache.has_key(keys_key):
+            keys = self._cache[keys_key].split(" ")
+        else:
+            return
+
+        for key in keys:
+            cache_key = self.cache_key(key)
+            if not self._cached.has_key(key) or self._cached[key]:
+                # Key either hasn't been loaded, or is one for the cache
+                self._value[key] = self._cache[cache_key]
+                self._type[key] = self._cache[cache_key + " type"]
+                self._cached[key] = 1
+
+    def cache_write(self, sync=1):
+        """Write information to the cache."""
+        self.cache_clear(sync=0)
+
+        keys = []
+        for key in self.keys():
+            cache_key = self.cache_key(key)
+            if not self._cached[key]:
+                if self._cache.has_key(cache_key):
+                    # Non-cached keys need to be cleared
+                    del(self._cache[cache_key])
+                    del(self._cache[cache_key + " type"])
+                continue
+
+            keys.append(key)
+            self._cache[cache_key] = self._value[key]
+            self._cache[cache_key + " type"] = self._type[key]
+
+        if self._root:
+            keys_key = " keys"
+        else:
+            keys_key = self._id
+
+        self._cache[keys_key] = " ".join(keys)
+        if sync:
+            self._cache.sync()
+
+    def cache_clear(self, sync=1):
+        """Remove information from the cache."""
+        if self._root:
+            keys_key = " keys"
+        else:
+            keys_key = self._id
+
+        if self._cache.has_key(keys_key):
+            keys = self._cache[keys_key].split(" ")
+            del(self._cache[keys_key])
+        else:
+            return
+
+        for key in keys:
+            cache_key = self.cache_key(key)
+            del(self._cache[cache_key])
+            del(self._cache[cache_key + " type"])
+
+        if sync:
+            self._cache.sync()
+
+    def has_key(self, key):
+        """Check whether the key exists."""
+        key = key.replace(" ", "_")
+        return self._value.has_key(key)
+
+    def key_type(self, key):
+        """Return the key type."""
+        key = key.replace(" ", "_")
+        return self._type[key]
+
+    def set(self, key, value, cached=1):
+        """Set the value of the given key.
+
+        If a set_KEY function exists that is called otherwise the
+        string function is called and the date function if that fails
+        (it nearly always will).
+        """
+        key = key.replace(" ", "_")
+
+        try:
+            func = getattr(self, "set_" + key)
+        except AttributeError:
+            pass
+        else:
+            return func(key, value)
+
+        if value == None:
+            return self.set_as_null(key, value)
+        else:
+            try:
+                return self.set_as_string(key, value)
+            except TypeError:
+                return self.set_as_date(key, value)
+
+    def get(self, key):
+        """Return the value of the given key.
+
+        If a get_KEY function exists that is called otherwise the
+        correctly typed function is called if that exists.
+        """
+        key = key.replace(" ", "_")
+
+        try:
+            func = getattr(self, "get_" + key)
+        except AttributeError:
+            pass
+        else:
+            return func(key)
+
+        try:
+            func = getattr(self, "get_as_" + self._type[key])
+        except AttributeError:
+            pass
+        else:
+            return func(key)
+
+        return self._value[key]
+
+    def set_as_string(self, key, value, cached=1):
+        """Set the key to the string value.
+
+        The value is converted to UTF-8 if it is a Unicode string, otherwise
+        it's assumed to have failed decoding (feedparser tries pretty hard)
+        so has all non-ASCII characters stripped.
+        """
+        value = utf8(value)
+
+        key = key.replace(" ", "_")
+        self._value[key] = value
+        self._type[key] = self.STRING
+        self._cached[key] = cached
+
+    def get_as_string(self, key):
+        """Return the key as a string value."""
+        key = key.replace(" ", "_")
+        if not self.has_key(key):
+            raise KeyError, key
+
+        return self._value[key]
+
+    def set_as_date(self, key, value, cached=1):
+        """Set the key to the date value.
+
+        The date should be a 9-item tuple as returned by time.gmtime().
+        """
+        value = " ".join([ str(s) for s in value ])
+
+        key = key.replace(" ", "_")
+        self._value[key] = value
+        self._type[key] = self.DATE
+        self._cached[key] = cached
+
+    def get_as_date(self, key):
+        """Return the key as a date value."""
+        key = key.replace(" ", "_")
+        if not self.has_key(key):
+            raise KeyError, key
+
+        value = self._value[key]
+        return tuple([ int(i) for i in value.split(" ") ])
+
+    def set_as_null(self, key, value, cached=1):
+        """Set the key to the null value.
+
+        This only exists to make things less magic.
+        """
+        key = key.replace(" ", "_")
+        self._value[key] = ""
+        self._type[key] = self.NULL
+        self._cached[key] = cached
+
+    def get_as_null(self, key):
+        """Return the key as the null value."""
+        key = key.replace(" ", "_")
+        if not self.has_key(key):
+            raise KeyError, key
+
+        return None
+
+    def del_key(self, key):
+        """Delete the given key."""
+        key = key.replace(" ", "_")
+        if not self.has_key(key):
+            raise KeyError, key
+
+        del(self._value[key])
+        del(self._type[key])
+        del(self._cached[key])
+
+    def keys(self):
+        """Return the list of cached keys."""
+        return self._value.keys()
+
+    def __iter__(self):
+        """Iterate the cached keys."""
+        return iter(self._value.keys())
+
+    # Special methods
+    __contains__ = has_key
+    __setitem__  = set_as_string
+    __getitem__  = get
+    __delitem__  = del_key
+    __delattr__  = del_key
+
+    def __setattr__(self, key, value):
+        if key.startswith("_"):
+            self.__dict__[key] = value
+        else:
+            self.set(key, value)
+
+    def __getattr__(self, key):
+        if self.has_key(key):
+            return self.get(key)
+        else:
+            raise AttributeError, key
+
+
+def filename(directory, filename):
+    """Return a filename suitable for the cache.
+
+    Strips dangerous and common characters to create a filename we
+    can use to store the cache in.
+    """
+    filename = re_url_scheme.sub("", filename)
+    filename = re_slash.sub(",", filename)
+    filename = re_initial_cruft.sub("", filename)
+    filename = re_final_cruft.sub("", filename)
+
+    return os.path.join(directory, filename)
+
+def utf8(value):
+    """Return the value as a UTF-8 string."""
+    if type(value) == type(u''):
+        return value.encode("utf-8")
+    else:
+        try:
+            return unicode(value, "utf-8").encode("utf-8")
+        except UnicodeError:
+            try:
+                return unicode(value, "iso-8859-1").encode("utf-8")
+            except UnicodeError:
+                return unicode(value, "ascii", "replace").encode("utf-8")

Added: planet/planet/cache.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/cache.pyo
==============================================================================
Binary file. No diff available.

Added: planet/planet/compat_logging/__init__.py
==============================================================================
--- (empty file)
+++ planet/planet/compat_logging/__init__.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,1196 @@
+# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in
+# supporting documentation, and that the name of Vinay Sajip
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+"""
+Logging package for Python. Based on PEP 282 and comments thereto in
+comp.lang.python, and influenced by Apache's log4j system.
+
+Should work under Python versions >= 1.5.2, except that source line
+information is not available unless 'sys._getframe()' is.
+
+Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
+
+To use, simply 'import logging' and log away!
+"""
+
+import sys, os, types, time, string, cStringIO
+
+try:
+    import thread
+    import threading
+except ImportError:
+    thread = None
+
+__author__  = "Vinay Sajip <vinay_sajip at red-dove.com>"
+__status__  = "beta"
+__version__ = "0.4.8.1"
+__date__    = "26 June 2003"
+
+#---------------------------------------------------------------------------
+#   Miscellaneous module data
+#---------------------------------------------------------------------------
+
+#
+#_srcfile is used when walking the stack to check when we've got the first
+# caller stack frame.
+#
+if string.lower(__file__[-4:]) in ['.pyc', '.pyo']:
+    _srcfile = __file__[:-4] + '.py'
+else:
+    _srcfile = __file__
+_srcfile = os.path.normcase(_srcfile)
+
+# _srcfile is only used in conjunction with sys._getframe().
+# To provide compatibility with older versions of Python, set _srcfile
+# to None if _getframe() is not available; this value will prevent
+# findCaller() from being called.
+if not hasattr(sys, "_getframe"):
+    _srcfile = None
+
+#
+#_startTime is used as the base when calculating the relative time of events
+#
+_startTime = time.time()
+
+#
+#raiseExceptions is used to see if exceptions during handling should be
+#propagated
+#
+raiseExceptions = 1
+
+#---------------------------------------------------------------------------
+#   Level related stuff
+#---------------------------------------------------------------------------
+#
+# Default levels and level names, these can be replaced with any positive set
+# of values having corresponding names. There is a pseudo-level, NOTSET, which
+# is only really there as a lower limit for user-defined levels. Handlers and
+# loggers are initialized with NOTSET so that they will log all messages, even
+# at user-defined levels.
+#
+CRITICAL = 50
+FATAL = CRITICAL
+ERROR = 40
+WARNING = 30
+WARN = WARNING
+INFO = 20
+DEBUG = 10
+NOTSET = 0
+
+_levelNames = {
+    CRITICAL : 'CRITICAL',
+    ERROR : 'ERROR',
+    WARNING : 'WARNING',
+    INFO : 'INFO',
+    DEBUG : 'DEBUG',
+    NOTSET : 'NOTSET',
+    'CRITICAL' : CRITICAL,
+    'ERROR' : ERROR,
+    'WARN' : WARNING,
+    'WARNING' : WARNING,
+    'INFO' : INFO,
+    'DEBUG' : DEBUG,
+    'NOTSET' : NOTSET,
+}
+
+def getLevelName(level):
+    """
+    Return the textual representation of logging level 'level'.
+
+    If the level is one of the predefined levels (CRITICAL, ERROR, WARNING,
+    INFO, DEBUG) then you get the corresponding string. If you have
+    associated levels with names using addLevelName then the name you have
+    associated with 'level' is returned. Otherwise, the string
+    "Level %s" % level is returned.
+    """
+    return _levelNames.get(level, ("Level %s" % level))
+
+def addLevelName(level, levelName):
+    """
+    Associate 'levelName' with 'level'.
+
+    This is used when converting levels to text during message formatting.
+    """
+    _acquireLock()
+    try:    #unlikely to cause an exception, but you never know...
+        _levelNames[level] = levelName
+        _levelNames[levelName] = level
+    finally:
+        _releaseLock()
+
+#---------------------------------------------------------------------------
+#   Thread-related stuff
+#---------------------------------------------------------------------------
+
+#
+#_lock is used to serialize access to shared data structures in this module.
+#This needs to be an RLock because fileConfig() creates Handlers and so
+#might arbitrary user threads. Since Handler.__init__() updates the shared
+#dictionary _handlers, it needs to acquire the lock. But if configuring,
+#the lock would already have been acquired - so we need an RLock.
+#The same argument applies to Loggers and Manager.loggerDict.
+#
+_lock = None
+
+def _acquireLock():
+    """
+    Acquire the module-level lock for serializing access to shared data.
+
+    This should be released with _releaseLock().
+    """
+    global _lock
+    if (not _lock) and thread:
+        _lock = threading.RLock()
+    if _lock:
+        _lock.acquire()
+
+def _releaseLock():
+    """
+    Release the module-level lock acquired by calling _acquireLock().
+    """
+    if _lock:
+        _lock.release()
+
+#---------------------------------------------------------------------------
+#   The logging record
+#---------------------------------------------------------------------------
+
+class LogRecord:
+    """
+    A LogRecord instance represents an event being logged.
+
+    LogRecord instances are created every time something is logged. They
+    contain all the information pertinent to the event being logged. The
+    main information passed in is in msg and args, which are combined
+    using str(msg) % args to create the message field of the record. The
+    record also includes information such as when the record was created,
+    the source line where the logging call was made, and any exception
+    information to be logged.
+    """
+    def __init__(self, name, level, pathname, lineno, msg, args, exc_info):
+        """
+        Initialize a logging record with interesting information.
+        """
+        ct = time.time()
+        self.name = name
+        self.msg = msg
+        self.args = args
+        self.levelname = getLevelName(level)
+        self.levelno = level
+        self.pathname = pathname
+        try:
+            self.filename = os.path.basename(pathname)
+            self.module = os.path.splitext(self.filename)[0]
+        except:
+            self.filename = pathname
+            self.module = "Unknown module"
+        self.exc_info = exc_info
+        self.lineno = lineno
+        self.created = ct
+        self.msecs = (ct - long(ct)) * 1000
+        self.relativeCreated = (self.created - _startTime) * 1000
+        if thread:
+            self.thread = thread.get_ident()
+        else:
+            self.thread = None
+        if hasattr(os, 'getpid'):
+            self.process = os.getpid()
+        else:
+            self.process = None
+
+    def __str__(self):
+        return '<LogRecord: %s, %s, %s, %s, "%s">'%(self.name, self.levelno,
+            self.pathname, self.lineno, self.msg)
+
+    def getMessage(self):
+        """
+        Return the message for this LogRecord.
+
+        Return the message for this LogRecord after merging any user-supplied
+        arguments with the message.
+        """
+        if not hasattr(types, "UnicodeType"): #if no unicode support...
+            msg = str(self.msg)
+        else:
+            try:
+                msg = str(self.msg)
+            except UnicodeError:
+                msg = self.msg      #Defer encoding till later
+        if self.args:
+            msg = msg % self.args
+        return msg
+
+def makeLogRecord(dict):
+    """
+    Make a LogRecord whose attributes are defined by the specified dictionary,
+    This function is useful for converting a logging event received over
+    a socket connection (which is sent as a dictionary) into a LogRecord
+    instance.
+    """
+    rv = LogRecord(None, None, "", 0, "", (), None)
+    rv.__dict__.update(dict)
+    return rv
+
+#---------------------------------------------------------------------------
+#   Formatter classes and functions
+#---------------------------------------------------------------------------
+
+class Formatter:
+    """
+    Formatter instances are used to convert a LogRecord to text.
+
+    Formatters need to know how a LogRecord is constructed. They are
+    responsible for converting a LogRecord to (usually) a string which can
+    be interpreted by either a human or an external system. The base Formatter
+    allows a formatting string to be specified. If none is supplied, the
+    default value of "%s(message)\\n" is used.
+
+    The Formatter can be initialized with a format string which makes use of
+    knowledge of the LogRecord attributes - e.g. the default value mentioned
+    above makes use of the fact that the user's message and arguments are pre-
+    formatted into a LogRecord's message attribute. Currently, the useful
+    attributes in a LogRecord are described by:
+
+    %(name)s            Name of the logger (logging channel)
+    %(levelno)s         Numeric logging level for the message (DEBUG, INFO,
+                        WARNING, ERROR, CRITICAL)
+    %(levelname)s       Text logging level for the message ("DEBUG", "INFO",
+                        "WARNING", "ERROR", "CRITICAL")
+    %(pathname)s        Full pathname of the source file where the logging
+                        call was issued (if available)
+    %(filename)s        Filename portion of pathname
+    %(module)s          Module (name portion of filename)
+    %(lineno)d          Source line number where the logging call was issued
+                        (if available)
+    %(created)f         Time when the LogRecord was created (time.time()
+                        return value)
+    %(asctime)s         Textual time when the LogRecord was created
+    %(msecs)d           Millisecond portion of the creation time
+    %(relativeCreated)d Time in milliseconds when the LogRecord was created,
+                        relative to the time the logging module was loaded
+                        (typically at application startup time)
+    %(thread)d          Thread ID (if available)
+    %(process)d         Process ID (if available)
+    %(message)s         The result of record.getMessage(), computed just as
+                        the record is emitted
+    """
+
+    converter = time.localtime
+
+    def __init__(self, fmt=None, datefmt=None):
+        """
+        Initialize the formatter with specified format strings.
+
+        Initialize the formatter either with the specified format string, or a
+        default as described above. Allow for specialized date formatting with
+        the optional datefmt argument (if omitted, you get the ISO8601 format).
+        """
+        if fmt:
+            self._fmt = fmt
+        else:
+            self._fmt = "%(message)s"
+        self.datefmt = datefmt
+
+    def formatTime(self, record, datefmt=None):
+        """
+        Return the creation time of the specified LogRecord as formatted text.
+
+        This method should be called from format() by a formatter which
+        wants to make use of a formatted time. This method can be overridden
+        in formatters to provide for any specific requirement, but the
+        basic behaviour is as follows: if datefmt (a string) is specified,
+        it is used with time.strftime() to format the creation time of the
+        record. Otherwise, the ISO8601 format is used. The resulting
+        string is returned. This function uses a user-configurable function
+        to convert the creation time to a tuple. By default, time.localtime()
+        is used; to change this for a particular formatter instance, set the
+        'converter' attribute to a function with the same signature as
+        time.localtime() or time.gmtime(). To change it for all formatters,
+        for example if you want all logging times to be shown in GMT,
+        set the 'converter' attribute in the Formatter class.
+        """
+        ct = self.converter(record.created)
+        if datefmt:
+            s = time.strftime(datefmt, ct)
+        else:
+            t = time.strftime("%Y-%m-%d %H:%M:%S", ct)
+            s = "%s,%03d" % (t, record.msecs)
+        return s
+
+    def formatException(self, ei):
+        """
+        Format and return the specified exception information as a string.
+
+        This default implementation just uses
+        traceback.print_exception()
+        """
+        import traceback
+        sio = cStringIO.StringIO()
+        traceback.print_exception(ei[0], ei[1], ei[2], None, sio)
+        s = sio.getvalue()
+        sio.close()
+        if s[-1] == "\n":
+            s = s[:-1]
+        return s
+
+    def format(self, record):
+        """
+        Format the specified record as text.
+
+        The record's attribute dictionary is used as the operand to a
+        string formatting operation which yields the returned string.
+        Before formatting the dictionary, a couple of preparatory steps
+        are carried out. The message attribute of the record is computed
+        using LogRecord.getMessage(). If the formatting string contains
+        "%(asctime)", formatTime() is called to format the event time.
+        If there is exception information, it is formatted using
+        formatException() and appended to the message.
+        """
+        record.message = record.getMessage()
+        if string.find(self._fmt,"%(asctime)") >= 0:
+            record.asctime = self.formatTime(record, self.datefmt)
+        s = self._fmt % record.__dict__
+        if record.exc_info:
+            if s[-1] != "\n":
+                s = s + "\n"
+            s = s + self.formatException(record.exc_info)
+        return s
+
+#
+#   The default formatter to use when no other is specified
+#
+_defaultFormatter = Formatter()
+
+class BufferingFormatter:
+    """
+    A formatter suitable for formatting a number of records.
+    """
+    def __init__(self, linefmt=None):
+        """
+        Optionally specify a formatter which will be used to format each
+        individual record.
+        """
+        if linefmt:
+            self.linefmt = linefmt
+        else:
+            self.linefmt = _defaultFormatter
+
+    def formatHeader(self, records):
+        """
+        Return the header string for the specified records.
+        """
+        return ""
+
+    def formatFooter(self, records):
+        """
+        Return the footer string for the specified records.
+        """
+        return ""
+
+    def format(self, records):
+        """
+        Format the specified records and return the result as a string.
+        """
+        rv = ""
+        if len(records) > 0:
+            rv = rv + self.formatHeader(records)
+            for record in records:
+                rv = rv + self.linefmt.format(record)
+            rv = rv + self.formatFooter(records)
+        return rv
+
+#---------------------------------------------------------------------------
+#   Filter classes and functions
+#---------------------------------------------------------------------------
+
+class Filter:
+    """
+    Filter instances are used to perform arbitrary filtering of LogRecords.
+
+    Loggers and Handlers can optionally use Filter instances to filter
+    records as desired. The base filter class only allows events which are
+    below a certain point in the logger hierarchy. For example, a filter
+    initialized with "A.B" will allow events logged by loggers "A.B",
+    "A.B.C", "A.B.C.D", "A.B.D" etc. but not "A.BB", "B.A.B" etc. If
+    initialized with the empty string, all events are passed.
+    """
+    def __init__(self, name=''):
+        """
+        Initialize a filter.
+
+        Initialize with the name of the logger which, together with its
+        children, will have its events allowed through the filter. If no
+        name is specified, allow every event.
+        """
+        self.name = name
+        self.nlen = len(name)
+
+    def filter(self, record):
+        """
+        Determine if the specified record is to be logged.
+
+        Is the specified record to be logged? Returns 0 for no, nonzero for
+        yes. If deemed appropriate, the record may be modified in-place.
+        """
+        if self.nlen == 0:
+            return 1
+        elif self.name == record.name:
+            return 1
+        elif string.find(record.name, self.name, 0, self.nlen) != 0:
+            return 0
+        return (record.name[self.nlen] == ".")
+
+class Filterer:
+    """
+    A base class for loggers and handlers which allows them to share
+    common code.
+    """
+    def __init__(self):
+        """
+        Initialize the list of filters to be an empty list.
+        """
+        self.filters = []
+
+    def addFilter(self, filter):
+        """
+        Add the specified filter to this handler.
+        """
+        if not (filter in self.filters):
+            self.filters.append(filter)
+
+    def removeFilter(self, filter):
+        """
+        Remove the specified filter from this handler.
+        """
+        if filter in self.filters:
+            self.filters.remove(filter)
+
+    def filter(self, record):
+        """
+        Determine if a record is loggable by consulting all the filters.
+
+        The default is to allow the record to be logged; any filter can veto
+        this and the record is then dropped. Returns a zero value if a record
+        is to be dropped, else non-zero.
+        """
+        rv = 1
+        for f in self.filters:
+            if not f.filter(record):
+                rv = 0
+                break
+        return rv
+
+#---------------------------------------------------------------------------
+#   Handler classes and functions
+#---------------------------------------------------------------------------
+
<<diff output has been trimmed to 500 lines, 697 line(s) remained.>>

Added: planet/planet/compat_logging/config.py
==============================================================================
--- (empty file)
+++ planet/planet/compat_logging/config.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,299 @@
+# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in
+# supporting documentation, and that the name of Vinay Sajip
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+"""
+Logging package for Python. Based on PEP 282 and comments thereto in
+comp.lang.python, and influenced by Apache's log4j system.
+
+Should work under Python versions >= 1.5.2, except that source line
+information is not available unless 'inspect' is.
+
+Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
+
+To use, simply 'import logging' and log away!
+"""
+
+import sys, logging, logging.handlers, string, thread, threading, socket, struct, os
+
+from SocketServer import ThreadingTCPServer, StreamRequestHandler
+
+
+DEFAULT_LOGGING_CONFIG_PORT = 9030
+if sys.platform == "win32":
+    RESET_ERROR = 10054   #WSAECONNRESET
+else:
+    RESET_ERROR = 104     #ECONNRESET
+
+#
+#   The following code implements a socket listener for on-the-fly
+#   reconfiguration of logging.
+#
+#   _listener holds the server object doing the listening
+_listener = None
+
+def fileConfig(fname, defaults=None):
+    """
+    Read the logging configuration from a ConfigParser-format file.
+
+    This can be called several times from an application, allowing an end user
+    the ability to select from various pre-canned configurations (if the
+    developer provides a mechanism to present the choices and load the chosen
+    configuration).
+    In versions of ConfigParser which have the readfp method [typically
+    shipped in 2.x versions of Python], you can pass in a file-like object
+    rather than a filename, in which case the file-like object will be read
+    using readfp.
+    """
+    import ConfigParser
+
+    cp = ConfigParser.ConfigParser(defaults)
+    if hasattr(cp, 'readfp') and hasattr(fname, 'readline'):
+        cp.readfp(fname)
+    else:
+        cp.read(fname)
+    #first, do the formatters...
+    flist = cp.get("formatters", "keys")
+    if len(flist):
+        flist = string.split(flist, ",")
+        formatters = {}
+        for form in flist:
+            sectname = "formatter_%s" % form
+            opts = cp.options(sectname)
+            if "format" in opts:
+                fs = cp.get(sectname, "format", 1)
+            else:
+                fs = None
+            if "datefmt" in opts:
+                dfs = cp.get(sectname, "datefmt", 1)
+            else:
+                dfs = None
+            f = logging.Formatter(fs, dfs)
+            formatters[form] = f
+    #next, do the handlers...
+    #critical section...
+    logging._acquireLock()
+    try:
+        try:
+            #first, lose the existing handlers...
+            logging._handlers.clear()
+            #now set up the new ones...
+            hlist = cp.get("handlers", "keys")
+            if len(hlist):
+                hlist = string.split(hlist, ",")
+                handlers = {}
+                fixups = [] #for inter-handler references
+                for hand in hlist:
+                    sectname = "handler_%s" % hand
+                    klass = cp.get(sectname, "class")
+                    opts = cp.options(sectname)
+                    if "formatter" in opts:
+                        fmt = cp.get(sectname, "formatter")
+                    else:
+                        fmt = ""
+                    klass = eval(klass, vars(logging))
+                    args = cp.get(sectname, "args")
+                    args = eval(args, vars(logging))
+                    h = apply(klass, args)
+                    if "level" in opts:
+                        level = cp.get(sectname, "level")
+                        h.setLevel(logging._levelNames[level])
+                    if len(fmt):
+                        h.setFormatter(formatters[fmt])
+                    #temporary hack for FileHandler and MemoryHandler.
+                    if klass == logging.handlers.MemoryHandler:
+                        if "target" in opts:
+                            target = cp.get(sectname,"target")
+                        else:
+                            target = ""
+                        if len(target): #the target handler may not be loaded yet, so keep for later...
+                            fixups.append((h, target))
+                    handlers[hand] = h
+                #now all handlers are loaded, fixup inter-handler references...
+                for fixup in fixups:
+                    h = fixup[0]
+                    t = fixup[1]
+                    h.setTarget(handlers[t])
+            #at last, the loggers...first the root...
+            llist = cp.get("loggers", "keys")
+            llist = string.split(llist, ",")
+            llist.remove("root")
+            sectname = "logger_root"
+            root = logging.root
+            log = root
+            opts = cp.options(sectname)
+            if "level" in opts:
+                level = cp.get(sectname, "level")
+                log.setLevel(logging._levelNames[level])
+            for h in root.handlers[:]:
+                root.removeHandler(h)
+            hlist = cp.get(sectname, "handlers")
+            if len(hlist):
+                hlist = string.split(hlist, ",")
+                for hand in hlist:
+                    log.addHandler(handlers[hand])
+            #and now the others...
+            #we don't want to lose the existing loggers,
+            #since other threads may have pointers to them.
+            #existing is set to contain all existing loggers,
+            #and as we go through the new configuration we
+            #remove any which are configured. At the end,
+            #what's left in existing is the set of loggers
+            #which were in the previous configuration but
+            #which are not in the new configuration.
+            existing = root.manager.loggerDict.keys()
+            #now set up the new ones...
+            for log in llist:
+                sectname = "logger_%s" % log
+                qn = cp.get(sectname, "qualname")
+                opts = cp.options(sectname)
+                if "propagate" in opts:
+                    propagate = cp.getint(sectname, "propagate")
+                else:
+                    propagate = 1
+                logger = logging.getLogger(qn)
+                if qn in existing:
+                    existing.remove(qn)
+                if "level" in opts:
+                    level = cp.get(sectname, "level")
+                    logger.setLevel(logging._levelNames[level])
+                for h in logger.handlers[:]:
+                    logger.removeHandler(h)
+                logger.propagate = propagate
+                logger.disabled = 0
+                hlist = cp.get(sectname, "handlers")
+                if len(hlist):
+                    hlist = string.split(hlist, ",")
+                    for hand in hlist:
+                        logger.addHandler(handlers[hand])
+            #Disable any old loggers. There's no point deleting
+            #them as other threads may continue to hold references
+            #and by disabling them, you stop them doing any logging.
+            for log in existing:
+                root.manager.loggerDict[log].disabled = 1
+        except:
+            import traceback
+            ei = sys.exc_info()
+            traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr)
+            del ei
+    finally:
+        logging._releaseLock()
+
+def listen(port=DEFAULT_LOGGING_CONFIG_PORT):
+    """
+    Start up a socket server on the specified port, and listen for new
+    configurations.
+
+    These will be sent as a file suitable for processing by fileConfig().
+    Returns a Thread object on which you can call start() to start the server,
+    and which you can join() when appropriate. To stop the server, call
+    stopListening().
+    """
+    if not thread:
+        raise NotImplementedError, "listen() needs threading to work"
+
+    class ConfigStreamHandler(StreamRequestHandler):
+        """
+        Handler for a logging configuration request.
+
+        It expects a completely new logging configuration and uses fileConfig
+        to install it.
+        """
+        def handle(self):
+            """
+            Handle a request.
+
+            Each request is expected to be a 4-byte length,
+            followed by the config file. Uses fileConfig() to do the
+            grunt work.
+            """
+            import tempfile
+            try:
+                conn = self.connection
+                chunk = conn.recv(4)
+                if len(chunk) == 4:
+                    slen = struct.unpack(">L", chunk)[0]
+                    chunk = self.connection.recv(slen)
+                    while len(chunk) < slen:
+                        chunk = chunk + conn.recv(slen - len(chunk))
+                    #Apply new configuration. We'd like to be able to
+                    #create a StringIO and pass that in, but unfortunately
+                    #1.5.2 ConfigParser does not support reading file
+                    #objects, only actual files. So we create a temporary
+                    #file and remove it later.
+                    file = tempfile.mktemp(".ini")
+                    f = open(file, "w")
+                    f.write(chunk)
+                    f.close()
+                    fileConfig(file)
+                    os.remove(file)
+            except socket.error, e:
+                if type(e.args) != types.TupleType:
+                    raise
+                else:
+                    errcode = e.args[0]
+                    if errcode != RESET_ERROR:
+                        raise
+
+    class ConfigSocketReceiver(ThreadingTCPServer):
+        """
+        A simple TCP socket-based logging config receiver.
+        """
+
+        allow_reuse_address = 1
+
+        def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
+                     handler=None):
+            ThreadingTCPServer.__init__(self, (host, port), handler)
+            logging._acquireLock()
+            self.abort = 0
+            logging._releaseLock()
+            self.timeout = 1
+
+        def serve_until_stopped(self):
+            import select
+            abort = 0
+            while not abort:
+                rd, wr, ex = select.select([self.socket.fileno()],
+                                           [], [],
+                                           self.timeout)
+                if rd:
+                    self.handle_request()
+                logging._acquireLock()
+                abort = self.abort
+                logging._releaseLock()
+
+    def serve(rcvr, hdlr, port):
+        server = rcvr(port=port, handler=hdlr)
+        global _listener
+        logging._acquireLock()
+        _listener = server
+        logging._releaseLock()
+        server.serve_until_stopped()
+
+    return threading.Thread(target=serve,
+                            args=(ConfigSocketReceiver,
+                                  ConfigStreamHandler, port))
+
+def stopListening():
+    """
+    Stop the listening server which was created with a call to listen().
+    """
+    global _listener
+    if _listener:
+        logging._acquireLock()
+        _listener.abort = 1
+        _listener = None
+        logging._releaseLock()

Added: planet/planet/compat_logging/handlers.py
==============================================================================
--- (empty file)
+++ planet/planet/compat_logging/handlers.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,728 @@
+# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
+#
+# Permission to use, copy, modify, and distribute this software and its
+# documentation for any purpose and without fee is hereby granted,
+# provided that the above copyright notice appear in all copies and that
+# both that copyright notice and this permission notice appear in
+# supporting documentation, and that the name of Vinay Sajip
+# not be used in advertising or publicity pertaining to distribution
+# of the software without specific, written prior permission.
+# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
+# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+"""
+Logging package for Python. Based on PEP 282 and comments thereto in
+comp.lang.python, and influenced by Apache's log4j system.
+
+Should work under Python versions >= 1.5.2, except that source line
+information is not available unless 'inspect' is.
+
+Copyright (C) 2001-2002 Vinay Sajip. All Rights Reserved.
+
+To use, simply 'import logging' and log away!
+"""
+
+import sys, logging, socket, types, os, string, cPickle, struct, time
+
+from SocketServer import ThreadingTCPServer, StreamRequestHandler
+
+#
+# Some constants...
+#
+
+DEFAULT_TCP_LOGGING_PORT    = 9020
+DEFAULT_UDP_LOGGING_PORT    = 9021
+DEFAULT_HTTP_LOGGING_PORT   = 9022
+DEFAULT_SOAP_LOGGING_PORT   = 9023
+SYSLOG_UDP_PORT             = 514
+
+
+class RotatingFileHandler(logging.FileHandler):
+    def __init__(self, filename, mode="a", maxBytes=0, backupCount=0):
+        """
+        Open the specified file and use it as the stream for logging.
+
+        By default, the file grows indefinitely. You can specify particular
+        values of maxBytes and backupCount to allow the file to rollover at
+        a predetermined size.
+
+        Rollover occurs whenever the current log file is nearly maxBytes in
+        length. If backupCount is >= 1, the system will successively create
+        new files with the same pathname as the base file, but with extensions
+        ".1", ".2" etc. appended to it. For example, with a backupCount of 5
+        and a base file name of "app.log", you would get "app.log",
+        "app.log.1", "app.log.2", ... through to "app.log.5". The file being
+        written to is always "app.log" - when it gets filled up, it is closed
+        and renamed to "app.log.1", and if files "app.log.1", "app.log.2" etc.
+        exist, then they are renamed to "app.log.2", "app.log.3" etc.
+        respectively.
+
+        If maxBytes is zero, rollover never occurs.
+        """
+        logging.FileHandler.__init__(self, filename, mode)
+        self.maxBytes = maxBytes
+        self.backupCount = backupCount
+        if maxBytes > 0:
+            self.mode = "a"
+
+    def doRollover(self):
+        """
+        Do a rollover, as described in __init__().
+        """
+
+        self.stream.close()
+        if self.backupCount > 0:
+            for i in range(self.backupCount - 1, 0, -1):
+                sfn = "%s.%d" % (self.baseFilename, i)
+                dfn = "%s.%d" % (self.baseFilename, i + 1)
+                if os.path.exists(sfn):
+                    #print "%s -> %s" % (sfn, dfn)
+                    if os.path.exists(dfn):
+                        os.remove(dfn)
+                    os.rename(sfn, dfn)
+            dfn = self.baseFilename + ".1"
+            if os.path.exists(dfn):
+                os.remove(dfn)
+            os.rename(self.baseFilename, dfn)
+            #print "%s -> %s" % (self.baseFilename, dfn)
+        self.stream = open(self.baseFilename, "w")
+
+    def emit(self, record):
+        """
+        Emit a record.
+
+        Output the record to the file, catering for rollover as described
+        in doRollover().
+        """
+        if self.maxBytes > 0:                   # are we rolling over?
+            msg = "%s\n" % self.format(record)
+            self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
+            if self.stream.tell() + len(msg) >= self.maxBytes:
+                self.doRollover()
+        logging.FileHandler.emit(self, record)
+
+
+class SocketHandler(logging.Handler):
+    """
+    A handler class which writes logging records, in pickle format, to
+    a streaming socket. The socket is kept open across logging calls.
+    If the peer resets it, an attempt is made to reconnect on the next call.
+    The pickle which is sent is that of the LogRecord's attribute dictionary
+    (__dict__), so that the receiver does not need to have the logging module
+    installed in order to process the logging event.
+
+    To unpickle the record at the receiving end into a LogRecord, use the
+    makeLogRecord function.
+    """
+
+    def __init__(self, host, port):
+        """
+        Initializes the handler with a specific host address and port.
+
+        The attribute 'closeOnError' is set to 1 - which means that if
+        a socket error occurs, the socket is silently closed and then
+        reopened on the next logging call.
+        """
+        logging.Handler.__init__(self)
+        self.host = host
+        self.port = port
+        self.sock = None
+        self.closeOnError = 0
+
+    def makeSocket(self):
+        """
+        A factory method which allows subclasses to define the precise
+        type of socket they want.
+        """
+        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        s.connect((self.host, self.port))
+        return s
+
+    def send(self, s):
+        """
+        Send a pickled string to the socket.
+
+        This function allows for partial sends which can happen when the
+        network is busy.
+        """
+        if hasattr(self.sock, "sendall"):
+            self.sock.sendall(s)
+        else:
+            sentsofar = 0
+            left = len(s)
+            while left > 0:
+                sent = self.sock.send(s[sentsofar:])
+                sentsofar = sentsofar + sent
+                left = left - sent
+
+    def makePickle(self, record):
+        """
+        Pickles the record in binary format with a length prefix, and
+        returns it ready for transmission across the socket.
+        """
+        s = cPickle.dumps(record.__dict__, 1)
+        #n = len(s)
+        #slen = "%c%c" % ((n >> 8) & 0xFF, n & 0xFF)
+        slen = struct.pack(">L", len(s))
+        return slen + s
+
+    def handleError(self, record):
+        """
+        Handle an error during logging.
+
+        An error has occurred during logging. Most likely cause -
+        connection lost. Close the socket so that we can retry on the
+        next event.
+        """
+        if self.closeOnError and self.sock:
+            self.sock.close()
+            self.sock = None        #try to reconnect next time
+        else:
+            logging.Handler.handleError(self, record)
+
+    def emit(self, record):
+        """
+        Emit a record.
+
+        Pickles the record and writes it to the socket in binary format.
+        If there is an error with the socket, silently drop the packet.
+        If there was a problem with the socket, re-establishes the
+        socket.
+        """
+        try:
+            s = self.makePickle(record)
+            if not self.sock:
+                self.sock = self.makeSocket()
+            self.send(s)
+        except:
+            self.handleError(record)
+
+    def close(self):
+        """
+        Closes the socket.
+        """
+        if self.sock:
+            self.sock.close()
+            self.sock = None
+
+class DatagramHandler(SocketHandler):
+    """
+    A handler class which writes logging records, in pickle format, to
+    a datagram socket.  The pickle which is sent is that of the LogRecord's
+    attribute dictionary (__dict__), so that the receiver does not need to
+    have the logging module installed in order to process the logging event.
+
+    To unpickle the record at the receiving end into a LogRecord, use the
+    makeLogRecord function.
+
+    """
+    def __init__(self, host, port):
+        """
+        Initializes the handler with a specific host address and port.
+        """
+        SocketHandler.__init__(self, host, port)
+        self.closeOnError = 0
+
+    def makeSocket(self):
+        """
+        The factory method of SocketHandler is here overridden to create
+        a UDP socket (SOCK_DGRAM).
+        """
+        s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+        return s
+
+    def send(self, s):
+        """
+        Send a pickled string to a socket.
+
+        This function no longer allows for partial sends which can happen
+        when the network is busy - UDP does not guarantee delivery and
+        can deliver packets out of sequence.
+        """
+        self.sock.sendto(s, (self.host, self.port))
+
+class SysLogHandler(logging.Handler):
+    """
+    A handler class which sends formatted logging records to a syslog
+    server. Based on Sam Rushing's syslog module:
+    http://www.nightmare.com/squirl/python-ext/misc/syslog.py
+    Contributed by Nicolas Untz (after which minor refactoring changes
+    have been made).
+    """
+
+    # from <linux/sys/syslog.h>:
+    # ======================================================================
+    # priorities/facilities are encoded into a single 32-bit quantity, where
+    # the bottom 3 bits are the priority (0-7) and the top 28 bits are the
+    # facility (0-big number). Both the priorities and the facilities map
+    # roughly one-to-one to strings in the syslogd(8) source code.  This
+    # mapping is included in this file.
+    #
+    # priorities (these are ordered)
+
+    LOG_EMERG     = 0       #  system is unusable
+    LOG_ALERT     = 1       #  action must be taken immediately
+    LOG_CRIT      = 2       #  critical conditions
+    LOG_ERR       = 3       #  error conditions
+    LOG_WARNING   = 4       #  warning conditions
+    LOG_NOTICE    = 5       #  normal but significant condition
+    LOG_INFO      = 6       #  informational
+    LOG_DEBUG     = 7       #  debug-level messages
+
+    #  facility codes
+    LOG_KERN      = 0       #  kernel messages
+    LOG_USER      = 1       #  random user-level messages
+    LOG_MAIL      = 2       #  mail system
+    LOG_DAEMON    = 3       #  system daemons
+    LOG_AUTH      = 4       #  security/authorization messages
+    LOG_SYSLOG    = 5       #  messages generated internally by syslogd
+    LOG_LPR       = 6       #  line printer subsystem
+    LOG_NEWS      = 7       #  network news subsystem
+    LOG_UUCP      = 8       #  UUCP subsystem
+    LOG_CRON      = 9       #  clock daemon
+    LOG_AUTHPRIV  = 10  #  security/authorization messages (private)
+
+    #  other codes through 15 reserved for system use
+    LOG_LOCAL0    = 16      #  reserved for local use
+    LOG_LOCAL1    = 17      #  reserved for local use
+    LOG_LOCAL2    = 18      #  reserved for local use
+    LOG_LOCAL3    = 19      #  reserved for local use
+    LOG_LOCAL4    = 20      #  reserved for local use
+    LOG_LOCAL5    = 21      #  reserved for local use
+    LOG_LOCAL6    = 22      #  reserved for local use
+    LOG_LOCAL7    = 23      #  reserved for local use
+
+    priority_names = {
+        "alert":    LOG_ALERT,
+        "crit":     LOG_CRIT,
+        "critical": LOG_CRIT,
+        "debug":    LOG_DEBUG,
+        "emerg":    LOG_EMERG,
+        "err":      LOG_ERR,
+        "error":    LOG_ERR,        #  DEPRECATED
+        "info":     LOG_INFO,
+        "notice":   LOG_NOTICE,
+        "panic":    LOG_EMERG,      #  DEPRECATED
+        "warn":     LOG_WARNING,    #  DEPRECATED
+        "warning":  LOG_WARNING,
+        }
+
+    facility_names = {
+        "auth":     LOG_AUTH,
+        "authpriv": LOG_AUTHPRIV,
+        "cron":     LOG_CRON,
+        "daemon":   LOG_DAEMON,
+        "kern":     LOG_KERN,
+        "lpr":      LOG_LPR,
+        "mail":     LOG_MAIL,
+        "news":     LOG_NEWS,
+        "security": LOG_AUTH,       #  DEPRECATED
+        "syslog":   LOG_SYSLOG,
+        "user":     LOG_USER,
+        "uucp":     LOG_UUCP,
+        "local0":   LOG_LOCAL0,
+        "local1":   LOG_LOCAL1,
+        "local2":   LOG_LOCAL2,
+        "local3":   LOG_LOCAL3,
+        "local4":   LOG_LOCAL4,
+        "local5":   LOG_LOCAL5,
+        "local6":   LOG_LOCAL6,
+        "local7":   LOG_LOCAL7,
+        }
+
+    def __init__(self, address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER):
+        """
+        Initialize a handler.
+
+        If address is specified as a string, UNIX socket is used.
+        If facility is not specified, LOG_USER is used.
+        """
+        logging.Handler.__init__(self)
+
+        self.address = address
+        self.facility = facility
+        if type(address) == types.StringType:
+            self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
+            # syslog may require either DGRAM or STREAM sockets
+            try:
+                self.socket.connect(address)
+            except socket.error:
+                self.socket.close()
+                self.socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+            self.socket.connect(address)
+            self.unixsocket = 1
+        else:
+            self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+            self.unixsocket = 0
+
+        self.formatter = None
+
+    # curious: when talking to the unix-domain '/dev/log' socket, a
+    #   zero-terminator seems to be required.  this string is placed
+    #   into a class variable so that it can be overridden if
+    #   necessary.
+    log_format_string = '<%d>%s\000'
+
+    def encodePriority (self, facility, priority):
+        """
+        Encode the facility and priority. You can pass in strings or
+        integers - if strings are passed, the facility_names and
+        priority_names mapping dictionaries are used to convert them to
+        integers.
+        """
+        if type(facility) == types.StringType:
+            facility = self.facility_names[facility]
+        if type(priority) == types.StringType:
+            priority = self.priority_names[priority]
+        return (facility << 3) | priority
+
+    def close (self):
+        """
+        Closes the socket.
+        """
+        if self.unixsocket:
+            self.socket.close()
+
+    def emit(self, record):
+        """
+        Emit a record.
+
+        The record is formatted, and then sent to the syslog server. If
+        exception information is present, it is NOT sent to the server.
+        """
+        msg = self.format(record)
+        """
+        We need to convert record level to lowercase, maybe this will
+        change in the future.
+        """
+        msg = self.log_format_string % (
+            self.encodePriority(self.facility,
+                                string.lower(record.levelname)),
+            msg)
+        try:
+            if self.unixsocket:
+                self.socket.send(msg)
+            else:
+                self.socket.sendto(msg, self.address)
+        except:
+            self.handleError(record)
+
+class SMTPHandler(logging.Handler):
+    """
+    A handler class which sends an SMTP email for each logging event.
+    """
+    def __init__(self, mailhost, fromaddr, toaddrs, subject):
+        """
+        Initialize the handler.
+
+        Initialize the instance with the from and to addresses and subject
+        line of the email. To specify a non-standard SMTP port, use the
+        (host, port) tuple format for the mailhost argument.
+        """
+        logging.Handler.__init__(self)
+        if type(mailhost) == types.TupleType:
+            host, port = mailhost
+            self.mailhost = host
+            self.mailport = port
+        else:
+            self.mailhost = mailhost
+            self.mailport = None
+        self.fromaddr = fromaddr
+        if type(toaddrs) == types.StringType:
+            toaddrs = [toaddrs]
+        self.toaddrs = toaddrs
+        self.subject = subject
+
+    def getSubject(self, record):
+        """
+        Determine the subject for the email.
+
+        If you want to specify a subject line which is record-dependent,
+        override this method.
+        """
+        return self.subject
+
+    weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
+
+    monthname = [None,
+                 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+                 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
+
+    def date_time(self):
+        """Return the current date and time formatted for a MIME header."""
+        year, month, day, hh, mm, ss, wd, y, z = time.gmtime(time.time())
+        s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (
+                self.weekdayname[wd],
+                day, self.monthname[month], year,
+                hh, mm, ss)
+        return s
+
+    def emit(self, record):
+        """
+        Emit a record.
+
+        Format the record and send it to the specified addressees.
+        """
+        try:
+            import smtplib
+            port = self.mailport
+            if not port:
+                port = smtplib.SMTP_PORT
+            smtp = smtplib.SMTP(self.mailhost, port)
+            msg = self.format(record)
+            msg = "From: %s\r\nTo: %s\r\nSubject: %s\r\nDate: %s\r\n\r\n%s" % (
+                            self.fromaddr,
+                            string.join(self.toaddrs, ","),
+                            self.getSubject(record),
+                            self.date_time(), msg)
+            smtp.sendmail(self.fromaddr, self.toaddrs, msg)
+            smtp.quit()
+        except:
+            self.handleError(record)
+
+class NTEventLogHandler(logging.Handler):
+    """
+    A handler class which sends events to the NT Event Log. Adds a
+    registry entry for the specified application name. If no dllname is
+    provided, win32service.pyd (which contains some basic message
+    placeholders) is used. Note that use of these placeholders will make
+    your event logs big, as the entire message source is held in the log.
+    If you want slimmer logs, you have to pass in the name of your own DLL
+    which contains the message definitions you want to use in the event log.
+    """
+    def __init__(self, appname, dllname=None, logtype="Application"):
+        logging.Handler.__init__(self)
+        try:
<<diff output has been trimmed to 500 lines, 229 line(s) remained.>>

Added: planet/planet/feedparser.py
==============================================================================
--- (empty file)
+++ planet/planet/feedparser.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,2931 @@
+#!/usr/bin/env python
+"""Universal feed parser
+
+Handles RSS 0.9x, RSS 1.0, RSS 2.0, CDF, Atom 0.3, and Atom 1.0 feeds
+
+Visit http://feedparser.org/ for the latest version
+Visit http://feedparser.org/docs/ for the latest documentation
+
+Required: Python 2.1 or later
+Recommended: Python 2.3 or later
+Recommended: CJKCodecs and iconv_codec <http://cjkpython.i18n.org/>
+"""
+
+__version__ = "4.1"# + "$Revision: 1.92 $"[11:15] + "-cvs"
+__license__ = """Copyright (c) 2002-2006, Mark Pilgrim, All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+  this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright notice,
+  this list of conditions and the following disclaimer in the documentation
+  and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE."""
+__author__ = "Mark Pilgrim <http://diveintomark.org/>"
+__contributors__ = ["Jason Diamond <http://injektilo.org/>",
+                    "John Beimler <http://john.beimler.org/>",
+                    "Fazal Majid <http://www.majid.info/mylos/weblog/>",
+                    "Aaron Swartz <http://aaronsw.com/>",
+                    "Kevin Marks <http://epeus.blogspot.com/>"]
+_debug = 0
+
+# HTTP "User-Agent" header to send to servers when downloading feeds.
+# If you are embedding feedparser in a larger application, you should
+# change this to your application name and URL.
+USER_AGENT = "UniversalFeedParser/%s +http://feedparser.org/" % __version__
+
+# HTTP "Accept" header to send to servers when downloading feeds.  If you don't
+# want to send an Accept header, set this to None.
+ACCEPT_HEADER = "application/atom+xml,application/rdf+xml,application/rss+xml,application/x-netcdf,application/xml;q=0.9,text/xml;q=0.2,*/*;q=0.1"
+
+# List of preferred XML parsers, by SAX driver name.  These will be tried first,
+# but if they're not installed, Python will keep searching through its own list
+# of pre-installed parsers until it finds one that supports everything we need.
+PREFERRED_XML_PARSERS = ["drv_libxml2"]
+
+# If you want feedparser to automatically run HTML markup through HTML Tidy, set
+# this to 1.  Requires mxTidy <http://www.egenix.com/files/python/mxTidy.html>
+# or utidylib <http://utidylib.berlios.de/>.
+TIDY_MARKUP = 0
+
+# List of Python interfaces for HTML Tidy, in order of preference.  Only useful
+# if TIDY_MARKUP = 1
+PREFERRED_TIDY_INTERFACES = ["uTidy", "mxTidy"]
+
+# ---------- required modules (should come with any Python distribution) ----------
+import sgmllib, re, sys, copy, urlparse, time, rfc822, types, cgi, urllib, urllib2
+try:
+    from cStringIO import StringIO as _StringIO
+except:
+    from StringIO import StringIO as _StringIO
+
+# ---------- optional modules (feedparser will work without these, but with reduced functionality) ----------
+
+# gzip is included with most Python distributions, but may not be available if you compiled your own
+try:
+    import gzip
+except:
+    gzip = None
+try:
+    import zlib
+except:
+    zlib = None
+
+# If a real XML parser is available, feedparser will attempt to use it.  feedparser has
+# been tested with the built-in SAX parser, PyXML, and libxml2.  On platforms where the
+# Python distribution does not come with an XML parser (such as Mac OS X 10.2 and some
+# versions of FreeBSD), feedparser will quietly fall back on regex-based parsing.
+try:
+    import xml.sax
+    xml.sax.make_parser(PREFERRED_XML_PARSERS) # test for valid parsers
+    from xml.sax.saxutils import escape as _xmlescape
+    _XML_AVAILABLE = 1
+except:
+    _XML_AVAILABLE = 0
+    def _xmlescape(data,entities={}):
+        data = data.replace('&', '&amp;')
+        data = data.replace('>', '&gt;')
+        data = data.replace('<', '&lt;')
+        for char, entity in entities:
+            data = data.replace(char, entity)
+        return data
+
+# base64 support for Atom feeds that contain embedded binary data
+try:
+    import base64, binascii
+except:
+    base64 = binascii = None
+
+# cjkcodecs and iconv_codec provide support for more character encodings.
+# Both are available from http://cjkpython.i18n.org/
+try:
+    import cjkcodecs.aliases
+except:
+    pass
+try:
+    import iconv_codec
+except:
+    pass
+
+# chardet library auto-detects character encodings
+# Download from http://chardet.feedparser.org/
+try:
+    import chardet
+    if _debug:
+        import chardet.constants
+        chardet.constants._debug = 1
+except:
+    chardet = None
+
+# ---------- don't touch these ----------
+class ThingsNobodyCaresAboutButMe(Exception): pass
+class CharacterEncodingOverride(ThingsNobodyCaresAboutButMe): pass
+class CharacterEncodingUnknown(ThingsNobodyCaresAboutButMe): pass
+class NonXMLContentType(ThingsNobodyCaresAboutButMe): pass
+class UndeclaredNamespace(Exception): pass
+
+sgmllib.tagfind = re.compile('[a-zA-Z][-_.:a-zA-Z0-9]*')
+sgmllib.special = re.compile('<!')
+sgmllib.charref = re.compile('&#(x?[0-9A-Fa-f]+)[^0-9A-Fa-f]')
+
+SUPPORTED_VERSIONS = {'': 'unknown',
+                      'rss090': 'RSS 0.90',
+                      'rss091n': 'RSS 0.91 (Netscape)',
+                      'rss091u': 'RSS 0.91 (Userland)',
+                      'rss092': 'RSS 0.92',
+                      'rss093': 'RSS 0.93',
+                      'rss094': 'RSS 0.94',
+                      'rss20': 'RSS 2.0',
+                      'rss10': 'RSS 1.0',
+                      'rss': 'RSS (unknown version)',
+                      'atom01': 'Atom 0.1',
+                      'atom02': 'Atom 0.2',
+                      'atom03': 'Atom 0.3',
+                      'atom10': 'Atom 1.0',
+                      'atom': 'Atom (unknown version)',
+                      'cdf': 'CDF',
+                      'hotrss': 'Hot RSS'
+                      }
+
+try:
+    UserDict = dict
+except NameError:
+    # Python 2.1 does not have dict
+    from UserDict import UserDict
+    def dict(aList):
+        rc = {}
+        for k, v in aList:
+            rc[k] = v
+        return rc
+
+class FeedParserDict(UserDict):
+    keymap = {'channel': 'feed',
+              'items': 'entries',
+              'guid': 'id',
+              'date': 'updated',
+              'date_parsed': 'updated_parsed',
+              'description': ['subtitle', 'summary'],
+              'url': ['href'],
+              'modified': 'updated',
+              'modified_parsed': 'updated_parsed',
+              'issued': 'published',
+              'issued_parsed': 'published_parsed',
+              'copyright': 'rights',
+              'copyright_detail': 'rights_detail',
+              'tagline': 'subtitle',
+              'tagline_detail': 'subtitle_detail'}
+    def __getitem__(self, key):
+        if key == 'category':
+            return UserDict.__getitem__(self, 'tags')[0]['term']
+        if key == 'categories':
+            return [(tag['scheme'], tag['term']) for tag in UserDict.__getitem__(self, 'tags')]
+        realkey = self.keymap.get(key, key)
+        if type(realkey) == types.ListType:
+            for k in realkey:
+                if UserDict.has_key(self, k):
+                    return UserDict.__getitem__(self, k)
+        if UserDict.has_key(self, key):
+            return UserDict.__getitem__(self, key)
+        return UserDict.__getitem__(self, realkey)
+
+    def __setitem__(self, key, value):
+        for k in self.keymap.keys():
+            if key == k:
+                key = self.keymap[k]
+                if type(key) == types.ListType:
+                    key = key[0]
+        return UserDict.__setitem__(self, key, value)
+
+    def get(self, key, default=None):
+        if self.has_key(key):
+            return self[key]
+        else:
+            return default
+
+    def setdefault(self, key, value):
+        if not self.has_key(key):
+            self[key] = value
+        return self[key]
+        
+    def has_key(self, key):
+        try:
+            return hasattr(self, key) or UserDict.has_key(self, key)
+        except AttributeError:
+            return False
+        
+    def __getattr__(self, key):
+        try:
+            return self.__dict__[key]
+        except KeyError:
+            pass
+        try:
+            assert not key.startswith('_')
+            return self.__getitem__(key)
+        except:
+            raise AttributeError, "object has no attribute '%s'" % key
+
+    def __setattr__(self, key, value):
+        if key.startswith('_') or key == 'data':
+            self.__dict__[key] = value
+        else:
+            return self.__setitem__(key, value)
+
+    def __contains__(self, key):
+        return self.has_key(key)
+
+def zopeCompatibilityHack():
+    global FeedParserDict
+    del FeedParserDict
+    def FeedParserDict(aDict=None):
+        rc = {}
+        if aDict:
+            rc.update(aDict)
+        return rc
+
+_ebcdic_to_ascii_map = None
+def _ebcdic_to_ascii(s):
+    global _ebcdic_to_ascii_map
+    if not _ebcdic_to_ascii_map:
+        emap = (
+            0,1,2,3,156,9,134,127,151,141,142,11,12,13,14,15,
+            16,17,18,19,157,133,8,135,24,25,146,143,28,29,30,31,
+            128,129,130,131,132,10,23,27,136,137,138,139,140,5,6,7,
+            144,145,22,147,148,149,150,4,152,153,154,155,20,21,158,26,
+            32,160,161,162,163,164,165,166,167,168,91,46,60,40,43,33,
+            38,169,170,171,172,173,174,175,176,177,93,36,42,41,59,94,
+            45,47,178,179,180,181,182,183,184,185,124,44,37,95,62,63,
+            186,187,188,189,190,191,192,193,194,96,58,35,64,39,61,34,
+            195,97,98,99,100,101,102,103,104,105,196,197,198,199,200,201,
+            202,106,107,108,109,110,111,112,113,114,203,204,205,206,207,208,
+            209,126,115,116,117,118,119,120,121,122,210,211,212,213,214,215,
+            216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,
+            123,65,66,67,68,69,70,71,72,73,232,233,234,235,236,237,
+            125,74,75,76,77,78,79,80,81,82,238,239,240,241,242,243,
+            92,159,83,84,85,86,87,88,89,90,244,245,246,247,248,249,
+            48,49,50,51,52,53,54,55,56,57,250,251,252,253,254,255
+            )
+        import string
+        _ebcdic_to_ascii_map = string.maketrans( \
+            ''.join(map(chr, range(256))), ''.join(map(chr, emap)))
+    return s.translate(_ebcdic_to_ascii_map)
+ 
+cp1252 = {
+  unichr(128): unichr(8364), # euro sign
+  unichr(130): unichr(8218), # single low-9 quotation mark
+  unichr(131): unichr( 402), # latin small letter f with hook
+  unichr(132): unichr(8222), # double low-9 quotation mark
+  unichr(133): unichr(8230), # horizontal ellipsis
+  unichr(134): unichr(8224), # dagger
+  unichr(135): unichr(8225), # double dagger
+  unichr(136): unichr( 710), # modifier letter circumflex accent
+  unichr(137): unichr(8240), # per mille sign
+  unichr(138): unichr( 352), # latin capital letter s with caron
+  unichr(139): unichr(8249), # single left-pointing angle quotation mark
+  unichr(140): unichr( 338), # latin capital ligature oe
+  unichr(142): unichr( 381), # latin capital letter z with caron
+  unichr(145): unichr(8216), # left single quotation mark
+  unichr(146): unichr(8217), # right single quotation mark
+  unichr(147): unichr(8220), # left double quotation mark
+  unichr(148): unichr(8221), # right double quotation mark
+  unichr(149): unichr(8226), # bullet
+  unichr(150): unichr(8211), # en dash
+  unichr(151): unichr(8212), # em dash
+  unichr(152): unichr( 732), # small tilde
+  unichr(153): unichr(8482), # trade mark sign
+  unichr(154): unichr( 353), # latin small letter s with caron
+  unichr(155): unichr(8250), # single right-pointing angle quotation mark
+  unichr(156): unichr( 339), # latin small ligature oe
+  unichr(158): unichr( 382), # latin small letter z with caron
+  unichr(159): unichr( 376)} # latin capital letter y with diaeresis
+
+_urifixer = re.compile('^([A-Za-z][A-Za-z0-9+-.]*://)(/*)(.*?)')
+def _urljoin(base, uri):
+    uri = _urifixer.sub(r'\1\3', uri)
+    return urlparse.urljoin(base, uri)
+
+class _FeedParserMixin:
+    namespaces = {'': '',
+                  'http://backend.userland.com/rss': '',
+                  'http://blogs.law.harvard.edu/tech/rss': '',
+                  'http://purl.org/rss/1.0/': '',
+                  'http://my.netscape.com/rdf/simple/0.9/': '',
+                  'http://example.com/newformat#': '',
+                  'http://example.com/necho': '',
+                  'http://purl.org/echo/': '',
+                  'uri/of/echo/namespace#': '',
+                  'http://purl.org/pie/': '',
+                  'http://purl.org/atom/ns#': '',
+                  'http://www.w3.org/2005/Atom': '',
+                  'http://purl.org/rss/1.0/modules/rss091#': '',
+                  
+                  'http://webns.net/mvcb/':                               'admin',
+                  'http://purl.org/rss/1.0/modules/aggregation/':         'ag',
+                  'http://purl.org/rss/1.0/modules/annotate/':            'annotate',
+                  'http://media.tangent.org/rss/1.0/':                    'audio',
+                  'http://backend.userland.com/blogChannelModule':        'blogChannel',
+                  'http://web.resource.org/cc/':                          'cc',
+                  'http://backend.userland.com/creativeCommonsRssModule': 'creativeCommons',
+                  'http://purl.org/rss/1.0/modules/company':              'co',
+                  'http://purl.org/rss/1.0/modules/content/':             'content',
+                  'http://my.theinfo.org/changed/1.0/rss/':               'cp',
+                  'http://purl.org/dc/elements/1.1/':                     'dc',
+                  'http://purl.org/dc/terms/':                            'dcterms',
+                  'http://purl.org/rss/1.0/modules/email/':               'email',
+                  'http://purl.org/rss/1.0/modules/event/':               'ev',
+                  'http://rssnamespace.org/feedburner/ext/1.0':           'feedburner',
+                  'http://freshmeat.net/rss/fm/':                         'fm',
+                  'http://xmlns.com/foaf/0.1/':                           'foaf',
+                  'http://www.w3.org/2003/01/geo/wgs84_pos#':             'geo',
+                  'http://postneo.com/icbm/':                             'icbm',
+                  'http://purl.org/rss/1.0/modules/image/':               'image',
+                  'http://www.itunes.com/DTDs/PodCast-1.0.dtd':           'itunes',
+                  'http://example.com/DTDs/PodCast-1.0.dtd':              'itunes',
+                  'http://purl.org/rss/1.0/modules/link/':                'l',
+                  'http://search.yahoo.com/mrss':                         'media',
+                  'http://madskills.com/public/xml/rss/module/pingback/': 'pingback',
+                  'http://prismstandard.org/namespaces/1.2/basic/':       'prism',
+                  'http://www.w3.org/1999/02/22-rdf-syntax-ns#':          'rdf',
+                  'http://www.w3.org/2000/01/rdf-schema#':                'rdfs',
+                  'http://purl.org/rss/1.0/modules/reference/':           'ref',
+                  'http://purl.org/rss/1.0/modules/richequiv/':           'reqv',
+                  'http://purl.org/rss/1.0/modules/search/':              'search',
+                  'http://purl.org/rss/1.0/modules/slash/':               'slash',
+                  'http://schemas.xmlsoap.org/soap/envelope/':            'soap',
+                  'http://purl.org/rss/1.0/modules/servicestatus/':       'ss',
+                  'http://hacks.benhammersley.com/rss/streaming/':        'str',
+                  'http://purl.org/rss/1.0/modules/subscription/':        'sub',
+                  'http://purl.org/rss/1.0/modules/syndication/':         'sy',
+                  'http://purl.org/rss/1.0/modules/taxonomy/':            'taxo',
+                  'http://purl.org/rss/1.0/modules/threading/':           'thr',
+                  'http://purl.org/rss/1.0/modules/textinput/':           'ti',
+                  'http://madskills.com/public/xml/rss/module/trackback/':'trackback',
+                  'http://wellformedweb.org/commentAPI/':                 'wfw',
+                  'http://purl.org/rss/1.0/modules/wiki/':                'wiki',
+                  'http://www.w3.org/1999/xhtml':                         'xhtml',
+                  'http://www.w3.org/XML/1998/namespace':                 'xml',
+                  'http://schemas.pocketsoap.com/rss/myDescModule/':      'szf'
+}
+    _matchnamespaces = {}
+
+    can_be_relative_uri = ['link', 'id', 'wfw_comment', 'wfw_commentrss', 'docs', 'url', 'href', 'comments', 'license', 'icon', 'logo']
+    can_contain_relative_uris = ['content', 'title', 'summary', 'info', 'tagline', 'subtitle', 'copyright', 'rights', 'description']
+    can_contain_dangerous_markup = ['content', 'title', 'summary', 'info', 'tagline', 'subtitle', 'copyright', 'rights', 'description']
+    html_types = ['text/html', 'application/xhtml+xml']
+    
+    def __init__(self, baseuri=None, baselang=None, encoding='utf-8'):
+        if _debug: sys.stderr.write('initializing FeedParser\n')
+        if not self._matchnamespaces:
+            for k, v in self.namespaces.items():
+                self._matchnamespaces[k.lower()] = v
+        self.feeddata = FeedParserDict() # feed-level data
+        self.encoding = encoding # character encoding
+        self.entries = [] # list of entry-level data
+        self.version = '' # feed type/version, see SUPPORTED_VERSIONS
+        self.namespacesInUse = {} # dictionary of namespaces defined by the feed
+
+        # the following are used internally to track state;
+        # this is really out of control and should be refactored
+        self.infeed = 0
+        self.inentry = 0
+        self.incontent = 0
+        self.intextinput = 0
+        self.inimage = 0
+        self.inauthor = 0
+        self.incontributor = 0
+        self.inpublisher = 0
+        self.insource = 0
+        self.sourcedata = FeedParserDict()
+        self.contentparams = FeedParserDict()
+        self._summaryKey = None
+        self.namespacemap = {}
+        self.elementstack = []
+        self.basestack = []
+        self.langstack = []
+        self.baseuri = baseuri or ''
+        self.lang = baselang or None
+        if baselang:
+            self.feeddata['language'] = baselang
+
+    def unknown_starttag(self, tag, attrs):
+        if _debug: sys.stderr.write('start %s with %s\n' % (tag, attrs))
+        # normalize attrs
+        attrs = [(k.lower(), v) for k, v in attrs]
+        attrs = [(k, k in ('rel', 'type') and v.lower() or v) for k, v in attrs]
+        
+        # track xml:base and xml:lang
+        attrsD = dict(attrs)
+        baseuri = attrsD.get('xml:base', attrsD.get('base')) or self.baseuri
+        self.baseuri = _urljoin(self.baseuri, baseuri)
+        lang = attrsD.get('xml:lang', attrsD.get('lang'))
+        if lang == '':
+            # xml:lang could be explicitly set to '', we need to capture that
+            lang = None
+        elif lang is None:
+            # if no xml:lang is specified, use parent lang
+            lang = self.lang
+        if lang:
+            if tag in ('feed', 'rss', 'rdf:RDF'):
+                self.feeddata['language'] = lang
+        self.lang = lang
+        self.basestack.append(self.baseuri)
+        self.langstack.append(lang)
+        
+        # track namespaces
+        for prefix, uri in attrs:
+            if prefix.startswith('xmlns:'):
+                self.trackNamespace(prefix[6:], uri)
+            elif prefix == 'xmlns':
+                self.trackNamespace(None, uri)
+
+        # track inline content
+        if self.incontent and self.contentparams.has_key('type') and not self.contentparams.get('type', 'xml').endswith('xml'):
+            # element declared itself as escaped markup, but it isn't really
+            self.contentparams['type'] = 'application/xhtml+xml'
+        if self.incontent and self.contentparams.get('type') == 'application/xhtml+xml':
+            # Note: probably shouldn't simply recreate localname here, but
+            # our namespace handling isn't actually 100% correct in cases where
+            # the feed redefines the default namespace (which is actually
+            # the usual case for inline content, thanks Sam), so here we
+            # cheat and just reconstruct the element based on localname
+            # because that compensates for the bugs in our namespace handling.
+            # This will horribly munge inline content with non-empty qnames,
+            # but nobody actually does that, so I'm not fixing it.
+            tag = tag.split(':')[-1]
+            return self.handle_data('<%s%s>' % (tag, self.strattrs(attrs)), escape=0)
+
+        # match namespaces
+        if tag.find(':') <> -1:
+            prefix, suffix = tag.split(':', 1)
+        else:
+            prefix, suffix = '', tag
+        prefix = self.namespacemap.get(prefix, prefix)
+        if prefix:
+            prefix = prefix + '_'
+
+        # special hack for better tracking of empty textinput/image elements in illformed feeds
+        if (not prefix) and tag not in ('title', 'link', 'description', 'name'):
+            self.intextinput = 0
+        if (not prefix) and tag not in ('title', 'link', 'description', 'url', 'href', 'width', 'height'):
+            self.inimage = 0
+        
+        # call special handler (if defined) or default handler
+        methodname = '_start_' + prefix + suffix
+        try:
+            method = getattr(self, methodname)
+            return method(attrsD)
+        except AttributeError:
+            return self.push(prefix + suffix, 1)
+
+    def unknown_endtag(self, tag):
+        if _debug: sys.stderr.write('end %s\n' % tag)
+        # match namespaces
+        if tag.find(':') <> -1:
+            prefix, suffix = tag.split(':', 1)
+        else:
+            prefix, suffix = '', tag
+        prefix = self.namespacemap.get(prefix, prefix)
<<diff output has been trimmed to 500 lines, 2432 line(s) remained.>>

Added: planet/planet/feedparser.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/feedparser.pyo
==============================================================================
Binary file. No diff available.

Added: planet/planet/htmltmpl.py
==============================================================================
--- (empty file)
+++ planet/planet/htmltmpl.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,1480 @@
+
+""" A templating engine for separation of code and HTML.
+
+    The documentation of this templating engine is separated to two parts:
+    
+        1. Description of the templating language.
+           
+        2. Documentation of classes and API of this module that provides
+           a Python implementation of the templating language.
+    
+    All the documentation can be found in 'doc' directory of the
+    distribution tarball or at the homepage of the engine.
+    Latest versions of this module are also available at that website.
+
+    You can use and redistribute this module under conditions of the
+    GNU General Public License that can be found either at
+    [ http://www.gnu.org/ ] or in file "LICENSE" contained in the
+    distribution tarball of this module.
+
+    Copyright (c) 2001 Tomas Styblo, tripie at cpan.org
+
+    @name           htmltmpl
+    @version        1.22
+    @author-name    Tomas Styblo
+    @author-email   tripie at cpan.org
+    @website        http://htmltmpl.sourceforge.net/
+    @license-name   GNU GPL
+    @license-url    http://www.gnu.org/licenses/gpl.html
+"""
+
+__version__ = 1.22
+__author__ = "Tomas Styblo (tripie at cpan.org)"
+
+# All imported modules are part of the standard Python library.
+
+from types import *
+import re
+import os
+import os.path
+import pprint       # only for debugging
+import sys
+import copy
+import cgi          # for HTML escaping of variables
+import urllib       # for URL escaping of variables
+import cPickle      # for template compilation
+import gettext
+
+INCLUDE_DIR = "inc"
+
+# Total number of possible parameters.
+# Increment if adding a parameter to any statement.
+PARAMS_NUMBER = 3
+
+# Relative positions of parameters in TemplateCompiler.tokenize().
+PARAM_NAME = 1
+PARAM_ESCAPE = 2
+PARAM_GLOBAL = 3
+PARAM_GETTEXT_STRING = 1
+
+# Find a way to lock files. Currently implemented only for UNIX and windows.
+LOCKTYPE_FCNTL = 1
+LOCKTYPE_MSVCRT = 2
+LOCKTYPE = None
+try:
+    import fcntl
+except:
+    try:
+        import msvcrt
+    except:
+        LOCKTYPE = None
+    else:
+        LOCKTYPE = LOCKTYPE_MSVCRT
+else:
+    LOCKTYPE = LOCKTYPE_FCNTL
+LOCK_EX = 1
+LOCK_SH = 2
+LOCK_UN = 3
+
+##############################################
+#          CLASS: TemplateManager            #
+##############################################
+
+class TemplateManager:
+    """  Class that manages compilation and precompilation of templates.
+    
+         You should use this class whenever you work with templates
+         that are stored in a file. The class can create a compiled
+         template and transparently manage its precompilation. It also
+         keeps the precompiled templates up-to-date by modification times
+         comparisons. 
+    """
+
+    def __init__(self, include=1, max_include=5, precompile=1, comments=1,
+                 gettext=0, debug=0):
+        """ Constructor.
+        
+            @header
+            __init__(include=1, max_include=5, precompile=1, comments=1,
+                     gettext=0, debug=0)
+            
+            @param include Enable or disable included templates.
+            This optional parameter can be used to enable or disable
+            <em>TMPL_INCLUDE</em> inclusion of templates. Disabling of
+            inclusion can improve performance a bit. The inclusion is
+            enabled by default.
+      
+            @param max_include Maximum depth of nested inclusions.
+            This optional parameter can be used to specify maximum depth of
+            nested <em>TMPL_INCLUDE</em> inclusions. It defaults to 5.
+            This setting prevents infinite recursive inclusions.
+            
+            @param precompile Enable or disable precompilation of templates.
+            This optional parameter can be used to enable or disable
+            creation and usage of precompiled templates.
+      
+            A precompiled template is saved to the same directory in
+            which the main template file is located. You need write
+            permissions to that directory.
+
+            Precompilation provides a significant performance boost because
+            it's not necessary to parse the templates over and over again.
+            The boost is especially noticeable when templates that include
+            other templates are used.
+            
+            Comparison of modification times of the main template and all
+            included templates is used to ensure that the precompiled
+            templates are up-to-date. Templates are also recompiled if the
+            htmltmpl module is updated.
+
+            The <em>TemplateError</em>exception is raised when the precompiled
+            template cannot be saved. Precompilation is enabled by default.
+
+            Precompilation is available only on UNIX and Windows platforms,
+            because proper file locking which is necessary to ensure
+            multitask safe behaviour is platform specific and is not
+            implemented for other platforms. Attempts to enable precompilation
+            on the other platforms result in raise of the
+            <em>TemplateError</em> exception.
+            
+            @param comments Enable or disable template comments.
+            This optional parameter can be used to enable or disable
+            template comments.
+            Disabling of the comments can improve performance a bit.
+            Comments are enabled by default.
+            
+            @param gettext Enable or disable gettext support.
+
+            @param debug Enable or disable debugging messages.
+            This optional parameter is a flag that can be used to enable
+            or disable debugging messages which are printed to the standard
+            error output. The debugging messages are disabled by default.
+        """
+        # Save the optional parameters.
+        # These values are not modified by any method.
+        self._include = include
+        self._max_include = max_include
+        self._precompile = precompile
+        self._comments = comments
+        self._gettext = gettext
+        self._debug = debug
+
+        # Find what module to use to lock files.
+        # File locking is necessary for the 'precompile' feature to be
+        # multitask/thread safe. Currently it works only on UNIX
+        # and Windows. Anyone willing to implement it on Mac ?
+        if precompile and not LOCKTYPE:
+                raise TemplateError, "Template precompilation is not "\
+                                     "available on this platform."
+        self.DEB("INIT DONE")
+
+    def prepare(self, file):
+        """ Preprocess, parse, tokenize and compile the template.
+            
+            If precompilation is enabled then this method tries to load
+            a precompiled form of the template from the same directory
+            in which the template source file is located. If it succeeds,
+            then it compares modification times stored in the precompiled
+            form to modification times of source files of the template,
+            including source files of all templates included via the
+            <em>TMPL_INCLUDE</em> statements. If any of the modification times
+            differs, then the template is recompiled and the precompiled
+            form updated.
+            
+            If precompilation is disabled, then this method parses and
+            compiles the template.
+            
+            @header prepare(file)
+            
+            @return Compiled template.
+            The methods returns an instance of the <em>Template</em> class
+            which is a compiled form of the template. This instance can be
+            used as input for the <em>TemplateProcessor</em>.
+            
+            @param file Path to the template file to prepare.
+            The method looks for the template file in current directory
+            if the parameter is a relative path. All included templates must
+            be placed in subdirectory <strong>'inc'</strong> of the 
+            directory in which the main template file is located.
+        """
+        compiled = None
+        if self._precompile:
+            if self.is_precompiled(file):
+                try:
+                    precompiled = self.load_precompiled(file)
+                except PrecompiledError, template:
+                    print >> sys.stderr, "Htmltmpl: bad precompiled "\
+                                         "template '%s' removed" % template
+                    compiled = self.compile(file)
+                    self.save_precompiled(compiled)
+                else:
+                    precompiled.debug(self._debug)
+                    compile_params = (self._include, self._max_include,
+                                      self._comments, self._gettext)
+                    if precompiled.is_uptodate(compile_params):
+                        self.DEB("PRECOMPILED: UPTODATE")
+                        compiled = precompiled
+                    else:
+                        self.DEB("PRECOMPILED: NOT UPTODATE")
+                        compiled = self.update(precompiled)
+            else:
+                self.DEB("PRECOMPILED: NOT PRECOMPILED")
+                compiled = self.compile(file)
+                self.save_precompiled(compiled)
+        else:
+            self.DEB("PRECOMPILATION DISABLED")
+            compiled = self.compile(file)
+        return compiled
+    
+    def update(self, template):
+        """ Update (recompile) a compiled template.
+        
+            This method recompiles a template compiled from a file.
+            If precompilation is enabled then the precompiled form saved on
+            disk is also updated.
+            
+            @header update(template)
+            
+            @return Recompiled template.
+            It's ensured that the returned template is up-to-date.
+            
+            @param template A compiled template.
+            This parameter should be an instance of the <em>Template</em>
+            class, created either by the <em>TemplateManager</em> or by the
+            <em>TemplateCompiler</em>. The instance must represent a template
+            compiled from a file on disk.
+        """
+        self.DEB("UPDATE")
+        updated = self.compile(template.file())
+        if self._precompile:
+            self.save_precompiled(updated)
+        return updated
+
+    ##############################################
+    #              PRIVATE METHODS               #
+    ##############################################    
+
+    def DEB(self, str):
+        """ Print debugging message to stderr if debugging is enabled. 
+            @hidden
+        """
+        if self._debug: print >> sys.stderr, str
+
+    def lock_file(self, file, lock):
+        """ Provide platform independent file locking.
+            @hidden
+        """
+        fd = file.fileno()
+        if LOCKTYPE == LOCKTYPE_FCNTL:
+            if lock == LOCK_SH:
+                fcntl.flock(fd, fcntl.LOCK_SH)
+            elif lock == LOCK_EX:
+                fcntl.flock(fd, fcntl.LOCK_EX)
+            elif lock == LOCK_UN:
+                fcntl.flock(fd, fcntl.LOCK_UN)
+            else:
+                raise TemplateError, "BUG: bad lock in lock_file"
+        elif LOCKTYPE == LOCKTYPE_MSVCRT:
+            if lock == LOCK_SH:
+                # msvcrt does not support shared locks :-(
+                msvcrt.locking(fd, msvcrt.LK_LOCK, 1)
+            elif lock == LOCK_EX:
+                msvcrt.locking(fd, msvcrt.LK_LOCK, 1)
+            elif lock == LOCK_UN:
+                msvcrt.locking(fd, msvcrt.LK_UNLCK, 1)
+            else:
+                raise TemplateError, "BUG: bad lock in lock_file"
+        else:
+            raise TemplateError, "BUG: bad locktype in lock_file"
+
+    def compile(self, file):
+        """ Compile the template.
+            @hidden
+        """
+        return TemplateCompiler(self._include, self._max_include,
+                                self._comments, self._gettext,
+                                self._debug).compile(file)
+    
+    def is_precompiled(self, file):
+        """ Return true if the template is already precompiled on the disk.
+            This method doesn't check whether the compiled template is
+            uptodate.
+            @hidden
+        """
+        filename = file + "c"   # "template.tmplc"
+        if os.path.isfile(filename):
+            return 1
+        else:
+            return 0
+        
+    def load_precompiled(self, file):
+        """ Load precompiled template from disk.
+
+            Remove the precompiled template file and recompile it
+            if the file contains corrupted or unpicklable data.
+            
+            @hidden
+        """
+        filename = file + "c"   # "template.tmplc"
+        self.DEB("LOADING PRECOMPILED")
+        try:
+            remove_bad = 0
+            file = None
+            try:
+                file = open(filename, "rb")
+                self.lock_file(file, LOCK_SH)
+                precompiled = cPickle.load(file)
+            except IOError, (errno, errstr):
+                raise TemplateError, "IO error in load precompiled "\
+                                     "template '%s': (%d) %s"\
+                                     % (filename, errno, errstr)
+            except cPickle.UnpicklingError:
+                remove_bad = 1
+                raise PrecompiledError, filename
+            except:
+                remove_bad = 1
+                raise
+            else:
+                return precompiled
+        finally:
+            if file:
+                self.lock_file(file, LOCK_UN)
+                file.close()
+            if remove_bad and os.path.isfile(filename):
+                # X: We may lose the original exception here, raising OSError.
+                os.remove(filename)
+                
+    def save_precompiled(self, template):
+        """ Save compiled template to disk in precompiled form.
+            
+            Associated metadata is also saved. It includes: filename of the
+            main template file, modification time of the main template file,
+            modification times of all included templates and version of the
+            htmltmpl module which compiled the template.
+            
+            The method removes a file which is saved only partially because
+            of some error.
+            
+            @hidden
+        """
+        filename = template.file() + "c"   # creates "template.tmplc"
+        # Check if we have write permission to the template's directory.
+        template_dir = os.path.dirname(os.path.abspath(filename))
+        if not os.access(template_dir, os.W_OK):
+            raise TemplateError, "Cannot save precompiled templates "\
+                                 "to '%s': write permission denied."\
+                                 % template_dir
+        try:
+            remove_bad = 0
+            file = None
+            try:
+                file = open(filename, "wb")   # may truncate existing file
+                self.lock_file(file, LOCK_EX)
+                BINARY = 1
+                READABLE = 0
+                if self._debug:
+                    cPickle.dump(template, file, READABLE)
+                else:
+                    cPickle.dump(template, file, BINARY)
+            except IOError, (errno, errstr):
+                remove_bad = 1
+                raise TemplateError, "IO error while saving precompiled "\
+                                     "template '%s': (%d) %s"\
+                                      % (filename, errno, errstr)
+            except cPickle.PicklingError, error:
+                remove_bad = 1
+                raise TemplateError, "Pickling error while saving "\
+                                     "precompiled template '%s': %s"\
+                                     % (filename, error)
+            except:
+                remove_bad = 1
+                raise
+            else:
+                self.DEB("SAVING PRECOMPILED")
+        finally:
+            if file:
+                self.lock_file(file, LOCK_UN)
+                file.close()
+            if remove_bad and os.path.isfile(filename):
+                # X: We may lose the original exception here, raising OSError.
+                os.remove(filename)
+
+
+##############################################
+#          CLASS: TemplateProcessor          #
+##############################################
+
+class TemplateProcessor:
+    """ Fill the template with data and process it.
+
+        This class provides actual processing of a compiled template.
+        Use it to set template variables and loops and then obtain
+        result of the processing.
+    """
+
+    def __init__(self, html_escape=1, magic_vars=1, global_vars=0, debug=0):
+        """ Constructor.
+
+            @header __init__(html_escape=1, magic_vars=1, global_vars=0,
+                             debug=0)
+
+            @param html_escape Enable or disable HTML escaping of variables.
+            This optional parameter is a flag that can be used to enable or
+            disable automatic HTML escaping of variables.
+            All variables are by default automatically HTML escaped. 
+            The escaping process substitutes HTML brackets, ampersands and
+            double quotes with appropriate HTML entities.
+            
+            @param magic_vars Enable or disable loop magic variables.
+            This parameter can be used to enable or disable
+            "magic" context variables, that are automatically defined inside
+            loops. Magic variables are enabled by default.
+
+            Refer to the language specification for description of these
+            magic variables.
+      
+            @param global_vars Globally activate global lookup of variables.
+            This optional parameter is a flag that can be used to specify
+            whether variables which cannot be found in the current scope
+            should be automatically looked up in enclosing scopes.
+
+            Automatic global lookup is disabled by default. Global lookup
+            can be overriden on a per-variable basis by the
+            <strong>GLOBAL</strong> parameter of a <strong>TMPL_VAR</strong>
+            statement.
+
+            @param debug Enable or disable debugging messages.
+        """
+        self._html_escape = html_escape
+        self._magic_vars = magic_vars
+        self._global_vars = global_vars
+        self._debug = debug        
+
+        # Data structure containing variables and loops set by the
+        # application. Use debug=1, process some template and
+        # then check stderr to see how the structure looks.
+        # It's modified only by set() and reset() methods.
+        self._vars = {}        
+
+        # Following variables are for multipart templates.
+        self._current_part = 1
+        self._current_pos = 0
+
+    def set(self, var, value):
+        """ Associate a value with top-level template variable or loop.
+
+            A template identifier can represent either an ordinary variable
+            (string) or a loop.
+
+            To assign a value to a string identifier pass a scalar
+            as the 'value' parameter. This scalar will be automatically
+            converted to string.
+
+            To assign a value to a loop identifier pass a list of mappings as
+            the 'value' parameter. The engine iterates over this list and
+            assigns values from the mappings to variables in a template loop
+            block if a key in the mapping corresponds to a name of a variable
+            in the loop block. The number of mappings contained in this list
+            is equal to number of times the loop block is repeated in the
+            output.
+      
+            @header set(var, value)
+            @return No return value.
+
+            @param var Name of template variable or loop.
+            @param value The value to associate.
+            
+        """
+        # The correctness of character case is verified only for top-level
+        # variables.
+        if self.is_ordinary_var(value):
+            # template top-level ordinary variable
+            if not var.islower():
+                raise TemplateError, "Invalid variable name '%s'." % var
+        elif type(value) == ListType:
+            # template top-level loop
+            if var != var.capitalize():
+                raise TemplateError, "Invalid loop name '%s'." % var
+        else:
+            raise TemplateError, "Value of toplevel variable '%s' must "\
<<diff output has been trimmed to 500 lines, 981 line(s) remained.>>

Added: planet/planet/htmltmpl.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/htmltmpl.pyo
==============================================================================
Binary file. No diff available.

Added: planet/planet/sanitize.py
==============================================================================
--- (empty file)
+++ planet/planet/sanitize.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,354 @@
+"""
+sanitize: bringing sanitiy to world of messed-up data
+"""
+
+__author__ = ["Mark Pilgrim <http://diveintomark.org/>", 
+              "Aaron Swartz <http://www.aaronsw.com/>"]
+__contributors__ = ["Sam Ruby <http://intertwingly.net/>"]
+__license__ = "BSD"
+__version__ = "0.25"
+
+_debug = 0
+
+# If you want sanitize to automatically run HTML markup through HTML Tidy, set
+# this to 1.  Requires mxTidy <http://www.egenix.com/files/python/mxTidy.html>
+# or utidylib <http://utidylib.berlios.de/>.
+TIDY_MARKUP = 0
+
+# List of Python interfaces for HTML Tidy, in order of preference.  Only useful
+# if TIDY_MARKUP = 1
+PREFERRED_TIDY_INTERFACES = ["uTidy", "mxTidy"]
+
+import sgmllib, re
+
+# chardet library auto-detects character encodings
+# Download from http://chardet.feedparser.org/
+try:
+    import chardet
+    if _debug:
+        import chardet.constants
+        chardet.constants._debug = 1
+
+    _chardet = lambda data: chardet.detect(data)['encoding']
+except:
+    chardet = None
+    _chardet = lambda data: None
+
+class _BaseHTMLProcessor(sgmllib.SGMLParser):
+    elements_no_end_tag = ['area', 'base', 'basefont', 'br', 'col', 'frame', 'hr',
+      'img', 'input', 'isindex', 'link', 'meta', 'param']
+    
+    _r_barebang = re.compile(r'<!((?!DOCTYPE|--|\[))', re.IGNORECASE)
+    _r_bareamp = re.compile("&(?!#\d+;|#x[0-9a-fA-F]+;|\w+;)")
+    _r_shorttag = re.compile(r'<([^<\s]+?)\s*/>')
+    
+    def __init__(self, encoding):
+        self.encoding = encoding
+        if _debug: sys.stderr.write('entering BaseHTMLProcessor, encoding=%s\n' % self.encoding)
+        sgmllib.SGMLParser.__init__(self)
+        
+    def reset(self):
+        self.pieces = []
+        sgmllib.SGMLParser.reset(self)
+
+    def _shorttag_replace(self, match):
+        tag = match.group(1)
+        if tag in self.elements_no_end_tag:
+            return '<' + tag + ' />'
+        else:
+            return '<' + tag + '></' + tag + '>'
+        
+    def feed(self, data):
+        data = self._r_barebang.sub(r'&lt;!\1', data)
+        data = self._r_bareamp.sub("&amp;", data)
+        data = self._r_shorttag.sub(self._shorttag_replace, data) 
+        if self.encoding and type(data) == type(u''):
+            data = data.encode(self.encoding)
+        sgmllib.SGMLParser.feed(self, data)
+
+    def normalize_attrs(self, attrs):
+        # utility method to be called by descendants
+        attrs = [(k.lower(), v) for k, v in attrs]
+        attrs = [(k, k in ('rel', 'type') and v.lower() or v) for k, v in attrs]
+        return attrs
+
+    def unknown_starttag(self, tag, attrs):
+        # called for each start tag
+        # attrs is a list of (attr, value) tuples
+        # e.g. for <pre class='screen'>, tag='pre', attrs=[('class', 'screen')]
+        if _debug: sys.stderr.write('_BaseHTMLProcessor, unknown_starttag, tag=%s\n' % tag)
+        uattrs = []
+        # thanks to Kevin Marks for this breathtaking hack to deal with (valid) high-bit attribute values in UTF-8 feeds
+        for key, value in attrs:
+            if type(value) != type(u''):
+                value = unicode(value, self.encoding)
+            uattrs.append((unicode(key, self.encoding), value))
+        strattrs = u''.join([u' %s="%s"' % (key, value) for key, value in uattrs]).encode(self.encoding)
+        if tag in self.elements_no_end_tag:
+            self.pieces.append('<%(tag)s%(strattrs)s />' % locals())
+        else:
+            self.pieces.append('<%(tag)s%(strattrs)s>' % locals())
+
+    def unknown_endtag(self, tag):
+        # called for each end tag, e.g. for </pre>, tag will be 'pre'
+        # Reconstruct the original end tag.
+        if tag not in self.elements_no_end_tag:
+            self.pieces.append("</%(tag)s>" % locals())
+
+    def handle_charref(self, ref):
+        # called for each character reference, e.g. for '&#160;', ref will be '160'
+        # Reconstruct the original character reference.
+        self.pieces.append('&#%(ref)s;' % locals())
+        
+    def handle_entityref(self, ref):
+        # called for each entity reference, e.g. for '&copy;', ref will be 'copy'
+        # Reconstruct the original entity reference.
+        self.pieces.append('&%(ref)s;' % locals())
+
+    def handle_data(self, text):
+        # called for each block of plain text, i.e. outside of any tag and
+        # not containing any character or entity references
+        # Store the original text verbatim.
+        if _debug: sys.stderr.write('_BaseHTMLProcessor, handle_text, text=%s\n' % text)
+        self.pieces.append(text)
+        
+    def handle_comment(self, text):
+        # called for each HTML comment, e.g. <!-- insert Javascript code here -->
+        # Reconstruct the original comment.
+        self.pieces.append('<!--%(text)s-->' % locals())
+        
+    def handle_pi(self, text):
+        # called for each processing instruction, e.g. <?instruction>
+        # Reconstruct original processing instruction.
+        self.pieces.append('<?%(text)s>' % locals())
+
+    def handle_decl(self, text):
+        # called for the DOCTYPE, if present, e.g.
+        # <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
+        #     "http://www.w3.org/TR/html4/loose.dtd">
+        # Reconstruct original DOCTYPE
+        self.pieces.append('<!%(text)s>' % locals())
+        
+    _new_declname_match = re.compile(r'[a-zA-Z][-_.a-zA-Z0-9:]*\s*').match
+    def _scan_name(self, i, declstartpos):
+        rawdata = self.rawdata
+        n = len(rawdata)
+        if i == n:
+            return None, -1
+        m = self._new_declname_match(rawdata, i)
+        if m:
+            s = m.group()
+            name = s.strip()
+            if (i + len(s)) == n:
+                return None, -1  # end of buffer
+            return name.lower(), m.end()
+        else:
+            self.handle_data(rawdata)
+#            self.updatepos(declstartpos, i)
+            return None, -1
+
+    def output(self):
+        '''Return processed HTML as a single string'''
+        return ''.join([str(p) for p in self.pieces])
+
+class _HTMLSanitizer(_BaseHTMLProcessor):
+    acceptable_elements = ['a', 'abbr', 'acronym', 'address', 'area', 'b', 'big',
+      'blockquote', 'br', 'button', 'caption', 'center', 'cite', 'code', 'col', 
+      'colgroup', 'dd', 'del', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset',
+      'font', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'input',
+      'ins', 'kbd', 'label', 'legend', 'li', 'map', 'menu', 'ol', 'optgroup', 
+      'option', 'p', 'pre', 'q', 's', 'samp', 'select', 'small', 'span', 'strike',
+      'strong', 'sub', 'sup', 'table', 'textarea', 'tbody', 'td', 'tfoot', 'th', 
+      'thead', 'tr', 'tt', 'u', 'ul', 'var']
+    
+    acceptable_attributes = ['abbr', 'accept', 'accept-charset', 'accesskey',
+      'action', 'align', 'alt', 'axis', 'border', 'cellpadding', 'cellspacing',
+      'char', 'charoff', 'charset', 'checked', 'cite', 'class', 'clear', 'cols',
+      'colspan', 'color', 'compact', 'coords', 'datetime', 'dir', 'disabled',
+      'enctype', 'for', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace',
+      'id', 'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'media', 'method',
+      'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt', 'readonly',
+      'rel', 'rev', 'rows', 'rowspan', 'rules', 'scope', 'selected', 'shape', 'size',
+      'span', 'src', 'start', 'summary', 'tabindex', 'target', 'title', 'type',
+      'usemap', 'valign', 'value', 'vspace', 'width']
+
+    ignorable_elements = ['script', 'applet', 'style']
+            
+    def reset(self):
+        _BaseHTMLProcessor.reset(self)
+        self.tag_stack = []
+        self.ignore_level = 0
+
+    def feed(self, data):
+        _BaseHTMLProcessor.feed(self, data)
+        while self.tag_stack:
+            _BaseHTMLProcessor.unknown_endtag(self, self.tag_stack.pop())
+        
+    def unknown_starttag(self, tag, attrs):
+        if tag in self.ignorable_elements:
+            self.ignore_level += 1
+            return
+        
+        if self.ignore_level:
+            return
+        
+        if tag in self.acceptable_elements:
+            attrs = self.normalize_attrs(attrs)
+            attrs = [(key, value) for key, value in attrs if key in self.acceptable_attributes]
+            if tag not in self.elements_no_end_tag:
+                self.tag_stack.append(tag)
+            _BaseHTMLProcessor.unknown_starttag(self, tag, attrs)
+        
+    def unknown_endtag(self, tag):
+        if tag in self.ignorable_elements:
+            self.ignore_level -= 1
+            return
+        
+        if self.ignore_level:
+            return
+        
+        if tag in self.acceptable_elements and tag not in self.elements_no_end_tag:
+            match = False
+            while self.tag_stack:
+                top = self.tag_stack.pop()
+                if top == tag:
+                    match = True
+                    break
+                _BaseHTMLProcessor.unknown_endtag(self, top)
+
+            if match:
+                _BaseHTMLProcessor.unknown_endtag(self, tag)
+
+    def handle_pi(self, text):
+        pass
+
+    def handle_decl(self, text):
+        pass
+
+    def handle_data(self, text):
+        if not self.ignore_level:
+            text = text.replace('<', '')
+            _BaseHTMLProcessor.handle_data(self, text)
+
+def HTML(htmlSource, encoding='utf8'):
+    p = _HTMLSanitizer(encoding)
+    p.feed(htmlSource)
+    data = p.output()
+    if TIDY_MARKUP:
+        # loop through list of preferred Tidy interfaces looking for one that's installed,
+        # then set up a common _tidy function to wrap the interface-specific API.
+        _tidy = None
+        for tidy_interface in PREFERRED_TIDY_INTERFACES:
+            try:
+                if tidy_interface == "uTidy":
+                    from tidy import parseString as _utidy
+                    def _tidy(data, **kwargs):
+                        return str(_utidy(data, **kwargs))
+                    break
+                elif tidy_interface == "mxTidy":
+                    from mx.Tidy import Tidy as _mxtidy
+                    def _tidy(data, **kwargs):
+                        nerrors, nwarnings, data, errordata = _mxtidy.tidy(data, **kwargs)
+                        return data
+                    break
+            except:
+                pass
+        if _tidy:
+            utf8 = type(data) == type(u'')
+            if utf8:
+                data = data.encode('utf-8')
+            data = _tidy(data, output_xhtml=1, numeric_entities=1, wrap=0, char_encoding="utf8")
+            if utf8:
+                data = unicode(data, 'utf-8')
+            if data.count('<body'):
+                data = data.split('<body', 1)[1]
+                if data.count('>'):
+                    data = data.split('>', 1)[1]
+            if data.count('</body'):
+                data = data.split('</body', 1)[0]
+    data = data.strip().replace('\r\n', '\n')
+    return data
+
+unicode_bom_map = {
+  '\x00\x00\xfe\xff': 'utf-32be',
+  '\xff\xfe\x00\x00': 'utf-32le',
+  '\xfe\xff##': 'utf-16be',
+  '\xff\xfe##': 'utf-16le',
+  '\xef\bb\bf': 'utf-8'
+}
+xml_bom_map = {
+  '\x00\x00\x00\x3c': 'utf-32be',
+  '\x3c\x00\x00\x00': 'utf-32le',
+  '\x00\x3c\x00\x3f': 'utf-16be',
+  '\x3c\x00\x3f\x00': 'utf-16le',
+  '\x3c\x3f\x78\x6d': 'utf-8', # or equivalent
+  '\x4c\x6f\xa7\x94': 'ebcdic'
+}
+
+_ebcdic_to_ascii_map = None
+def _ebcdic_to_ascii(s):
+    global _ebcdic_to_ascii_map
+    if not _ebcdic_to_ascii_map:
+        emap = (
+            0,1,2,3,156,9,134,127,151,141,142,11,12,13,14,15,
+            16,17,18,19,157,133,8,135,24,25,146,143,28,29,30,31,
+            128,129,130,131,132,10,23,27,136,137,138,139,140,5,6,7,
+            144,145,22,147,148,149,150,4,152,153,154,155,20,21,158,26,
+            32,160,161,162,163,164,165,166,167,168,91,46,60,40,43,33,
+            38,169,170,171,172,173,174,175,176,177,93,36,42,41,59,94,
+            45,47,178,179,180,181,182,183,184,185,124,44,37,95,62,63,
+            186,187,188,189,190,191,192,193,194,96,58,35,64,39,61,34,
+            195,97,98,99,100,101,102,103,104,105,196,197,198,199,200,201,
+            202,106,107,108,109,110,111,112,113,114,203,204,205,206,207,208,
+            209,126,115,116,117,118,119,120,121,122,210,211,212,213,214,215,
+            216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,
+            123,65,66,67,68,69,70,71,72,73,232,233,234,235,236,237,
+            125,74,75,76,77,78,79,80,81,82,238,239,240,241,242,243,
+            92,159,83,84,85,86,87,88,89,90,244,245,246,247,248,249,
+            48,49,50,51,52,53,54,55,56,57,250,251,252,253,254,255
+            )
+        import string
+        _ebcdic_to_ascii_map = string.maketrans( \
+            ''.join(map(chr, range(256))), ''.join(map(chr, emap)))
+    return s.translate(_ebcdic_to_ascii_map)
+
+def _startswithbom(text, bom):
+    for i, c in enumerate(bom):
+        if c == '#':
+            if text[i] == '\x00':
+                return False
+        else:
+            if text[i] != c:
+                return False
+    return True
+
+def _detectbom(text, bom_map=unicode_bom_map):
+    for bom, encoding in bom_map.iteritems():
+        if _startswithbom(text, bom):
+            return encoding
+    return None
+
+def characters(text, isXML=False, guess=None):
+    """
+    Takes a string text of unknown encoding and tries to 
+    provide a Unicode string for it.
+    """
+    _triedEncodings = []
+    def tryEncoding(encoding):
+        if encoding and encoding not in _triedEncodings:
+            if encoding == 'ebcdic':
+                return _ebcdic_to_ascii(text)
+            try:
+                return unicode(text, encoding)
+            except UnicodeDecodeError:
+                pass
+            _triedEncodings.append(encoding)
+    
+    return (
+      tryEncoding(guess) or 
+      tryEncoding(_detectbom(text)) or 
+      isXML and tryEncoding(_detectbom(text, xml_bom_map)) or
+      tryEncoding(_chardet(text)) or
+      tryEncoding('utf8') or
+      tryEncoding('windows-1252') or
+      tryEncoding('iso-8859-1'))

Added: planet/planet/sanitize.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/sanitize.pyo
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/__init__.py
==============================================================================

Added: planet/planet/tests/__init__.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/data/simple.tmpl
==============================================================================
--- (empty file)
+++ planet/planet/tests/data/simple.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,4 @@
+<TMPL_LOOP Channels>
+<TMPL_VAR name>
+
+</TMPL_LOOP>

Added: planet/planet/tests/data/simple.tmplc
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/data/simple2.tmpl
==============================================================================
--- (empty file)
+++ planet/planet/tests/data/simple2.tmpl	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,4 @@
+<TMPL_LOOP Channels>
+<TMPL_VAR name>
+
+</TMPL_LOOP>

Added: planet/planet/tests/data/simple2.tmplc
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/test_channel.py
==============================================================================
--- (empty file)
+++ planet/planet/tests/test_channel.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import unittest
+import planet
+import tempfile
+import ConfigParser
+
+class FakePlanet:
+    """
+    A dummy Planet object that's enough to fool the
+    Channel.__init__ method
+    """
+
+    def __init__(self):
+        self.cache_directory = tempfile.gettempdir()
+        self.config = ConfigParser.ConfigParser()
+
+class FeedInformationTest(unittest.TestCase):
+    """
+    Test the Channel.feed_information method
+    """
+
+    def setUp(self):
+        self.url = 'URL'
+        self.changed_url = 'Changed URL'
+        self.channel = planet.Channel(FakePlanet(), self.url)
+
+    def test_unchangedurl(self):
+        self.assertEqual(self.channel.feed_information(), '<%s>' % self.url)
+               
+    def test_changedurl(self):
+        # change the URL directly
+        self.channel.url = self.changed_url
+        self.assertEqual(self.channel.feed_information(),
+           "<%s> (formerly <%s>)" % (self.changed_url, self.url))
+
+if __name__ == '__main__':
+    unittest.main()

Added: planet/planet/tests/test_channel.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/test_main.py
==============================================================================
--- (empty file)
+++ planet/planet/tests/test_main.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+import os, sys, shutil, errno, unittest
+from ConfigParser import ConfigParser
+from StringIO import StringIO
+import planet
+
+class MainTest(unittest.TestCase):
+    
+    def test_minimal(self):
+        configp = ConfigParser()
+        my_planet = planet.Planet(configp)
+        my_planet.run("Planet Name", "http://example.com", [])
+
+    def test_onefeed(self):
+        configp = ConfigParser()
+        configp.readfp(StringIO("""[http://www.example.com/]
+name = Mary
+"""))
+        my_planet = planet.Planet(configp)
+        my_planet.run("Planet Name", "http://example.com", [], True)
+
+
+    def test_generateall(self):
+        configp = ConfigParser()
+        configp.readfp(StringIO("""[http://www.example.com/]
+name = Mary
+"""))
+        my_planet = planet.Planet(configp)
+        my_planet.run("Planet Name", "http://example.com", [], True)
+        basedir = os.path.join(os.path.dirname(os.path.abspath(sys.modules[__name__].__file__)), 'data')
+        os.mkdir(self.output_dir)
+        t_file_names = ['simple', 'simple2']
+        self._remove_cached_templates(basedir, t_file_names)
+        t_files = [os.path.join(basedir, t_file) + '.tmpl' for t_file in t_file_names]
+        my_planet.generate_all_files(t_files, "Planet Name",
+                'http://example.com/', 'http://example.com/feed/', 'Mary', 'mary at example.com')
+        for file_name in t_file_names:
+            name = os.path.join(self.output_dir, file_name)
+            content = file(name).read()
+            self.assertEqual(content, 'Mary\n')
+
+    def _remove_cached_templates(self, basedir, template_files):
+        """
+        Remove the .tmplc files and force them to be rebuilt.
+
+        This is required mainly so that the tests don't fail in mysterious ways in
+        directories that have been moved, eg 'branches/my-branch' to
+        'branches/mysterious-branch' -- the .tmplc files seem to remember their full
+        path
+        """
+        for file in template_files:
+            path = os.path.join(basedir, file + '.tmplc')
+            try:
+                os.remove(path)
+            except OSError, e:
+                # we don't care about the file not being there, we care about
+                # everything else
+                if e.errno != errno.ENOENT:
+                    raise
+
+    def setUp(self):
+        super(MainTest, self).setUp()
+        self.output_dir = 'output'
+
+    def tearDown(self):
+        super(MainTest, self).tearDown()
+        shutil.rmtree(self.output_dir, ignore_errors = True)
+        shutil.rmtree('cache', ignore_errors = True)
+
+if __name__ == '__main__':
+    unittest.main()

Added: planet/planet/tests/test_main.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/test_sanitize.py
==============================================================================
--- (empty file)
+++ planet/planet/tests/test_sanitize.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,125 @@
+# adapted from http://www.iamcal.com/publish/articles/php/processing_html_part_2/
+# and from http://feedparser.org/tests/wellformed/sanitize/
+# by Aaron Swartz, 2006, public domain
+
+import unittest, new
+from planet import sanitize
+
+class SanitizeTest(unittest.TestCase): pass
+
+# each call to HTML adds a test case to SanitizeTest
+testcases = 0
+def HTML(a, b):
+  global testcases
+  testcases += 1
+  func = lambda self: self.assertEqual(sanitize.HTML(a), b)
+  method = new.instancemethod(func, None, SanitizeTest)
+  setattr(SanitizeTest, "test_%d" % testcases, method)
+
+## basics
+HTML("","")
+HTML("hello","hello")
+
+## balancing tags
+HTML("<b>hello","<b>hello</b>")
+HTML("hello<b>","hello<b></b>")
+HTML("hello</b>","hello")
+HTML("hello<b/>","hello<b></b>")
+HTML("<b><b><b>hello","<b><b><b>hello</b></b></b>")
+HTML("</b><b>","<b></b>")
+
+## trailing slashes
+HTML('<img>','<img />')
+HTML('<img/>','<img />')
+HTML('<b/></b>','<b></b>')
+
+## balancing angle brakets
+HTML('<img src="foo"','')
+HTML('b>','b>')
+HTML('<img src="foo"/','')
+HTML('>','>')
+HTML('foo<b','foo')
+HTML('b>foo','b>foo')
+HTML('><b','>')
+HTML('b><','b>')
+HTML('><b>','><b></b>')
+
+## attributes
+HTML('<img src=foo>','<img src="foo" />')
+HTML('<img asrc=foo>','<img />')
+HTML('<img src=test test>','<img src="test" />')
+
+## dangerous tags (a small sample)
+sHTML = lambda x: HTML(x, 'safe <b>description</b>')
+sHTML('safe<applet code="foo.class" codebase="http://example.com/"></applet> <b>description</b>')
+sHTML('<notinventedyet>safe</notinventedyet> <b>description</b>')
+sHTML('<blink>safe</blink> <b>description</b>')
+sHTML('safe<embed src="http://example.com/"> <b>description</b>')
+sHTML('safe<frameset rows="*"><frame src="http://example.com/"></frameset> <b>description</b>')
+sHTML('safe<iframe src="http://example.com/"> <b>description</b></iframe>')
+sHTML('safe<link rel="stylesheet" type="text/css" href="http://example.com/evil.css"> <b>description</b>')
+sHTML('safe<meta http-equiv="Refresh" content="0; URL=http://example.com/"> <b>description</b>')
+sHTML('safe<object classid="clsid:C932BA85-4374-101B-A56C-00AA003668DC"> <b>description</b>')
+sHTML('safe<script type="text/javascript">location.href=\'http:/\'+\'/example.com/\';</script> <b>description</b>')
+
+for x in ['onabort', 'onblur', 'onchange', 'onclick', 'ondblclick', 'onerror', 'onfocus', 'onkeydown', 'onkeypress', 'onkeyup', 'onload', 'onmousedown', 'onmouseout', 'onmouseover', 'onmouseup', 'onreset', 'resize', 'onsubmit', 'onunload']:
+    HTML('<img src="http://www.ragingplatypus.com/i/cam-full.jpg" %s="location.href=\'http://www.ragingplatypus.com/\';" />' % x,
+    '<img src="http://www.ragingplatypus.com/i/cam-full.jpg" />')
+
+HTML('<a href="http://www.ragingplatypus.com/" style="display:block; position:absolute; left:0; top:0; width:100%; height:100%; z-index:1; background-color:black; background-image:url(http://www.ragingplatypus.com/i/cam-full.jpg); background-x:center; background-y:center; background-repeat:repeat;">never trust your upstream platypus</a>', '<a href="http://www.ragingplatypus.com/">never trust your upstream platypus</a>')
+
+## ignorables
+HTML('foo<style>bar', 'foo')
+HTML('foo<style>bar</style>', 'foo')
+
+## non-allowed tags
+HTML('<script>','')
+HTML('<script','')
+HTML('<script/>','')
+HTML('</script>','')
+HTML('<script woo=yay>','')
+HTML('<script woo="yay">','')
+HTML('<script woo="yay>','')
+HTML('<script woo="yay<b>','')
+HTML('<script<script>>','')
+HTML('<<script>script<script>>','')
+HTML('<<script><script>>','')
+HTML('<<script>script>>','')
+HTML('<<script<script>>','')
+
+## bad protocols
+HTML('<a href="http://foo">bar</a>', '<a href="http://foo">bar</a>')
+HTML('<a href="ftp://foo">bar</a>', '<a href="ftp://foo">bar</a>')
+HTML('<a href="mailto:foo">bar</a>', '<a href="mailto:foo">bar</a>')
+
+# not yet supported:
+#HTML('<a href="javascript:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="java script:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="java\tscript:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="java\nscript:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="java'+chr(1)+'script:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="jscript:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="vbscript:foo">bar</a>', '<a href="#foo">bar</a>')
+#HTML('<a href="view-source:foo">bar</a>', '<a href="#foo">bar</a>')
+
+## auto closers
+HTML('<img src="a">', '<img src="a" />')
+HTML('<img src="a">foo</img>', '<img src="a" />foo')
+HTML('</img>', '')
+
+## crazy: http://alpha-geek.com/example/crazy_html2.html
+HTML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r\n\r\n<html xmlns="http://www.w3.org/1999/xhtml">\r\n<head>\r\n<title>Crazy HTML -- Can Your Regex Parse This?</title>\r\n</head>\r\n<body    notRealAttribute="value"onload="executeMe();"foo="bar"\r\n\r\n>\r\n<!-- <script> -->\r\n\r\n<!-- \r\n\t<script> \r\n-->\r\n\r\n</script>\r\n\r\n\r\n<script\r\n\r\n\r\n>\r\n\r\nfunction executeMe()\r\n{\r\n\r\n\r\n\r\n\r\n/* <script> \r\nfunction am_i_javascript()\r\n{\r\n\tvar str = "Some innocuously commented out stuff";\r\n}\r\n< /script>\r\n*/\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\talert("Executed");\r\n}\r\n\r\n                                   </script\r\n\r\n\r\n\r\n>\r\n<h1>Did The Javascript Execute?</h1>\r\n<div notRealAttribute="value\r\n"onmouseover="\r\nexecuteMe();\r\n"foo="bar">\r\nI will execute here, too, if you mouse over me\r\n</div>\r\nThis is to keep you guys honest...<b
 r />\r\nI like ontonology.  I like to script ontology.  Though, script>style>this.\r\n</body>\r\n</html>', 'Crazy HTML -- Can Your Regex Parse This?\n\n\n<!-- <script> -->\n\n<!-- \n\t<script> \n-->\n\n\n\nfunction executeMe()\n{\n\n\n\n\n/* \n<h1>Did The Javascript Execute?</h1>\n<div>\nI will execute here, too, if you mouse over me\n</div>\nThis is to keep you guys honest...<br />\nI like ontonology.  I like to script ontology.  Though, script>style>this.')
+
+# valid entity references
+HTML("&nbsp;","&nbsp;");
+HTML("&#160;","&#160;");
+HTML("&#xa0;","&#xa0;");
+HTML("&#xA0;","&#xA0;");
+
+# unescaped ampersands
+HTML("AT&T","AT&amp;T");
+HTML("http://example.org?a=1&b=2","http://example.org?a=1&amp;b=2");
+
+# quote characters
+HTML('<a title="&#34;">quote</a>','<a title="&#34;">quote</a>')
+HTML('<a title="&#39;">quote</a>','<a title="&#39;">quote</a>')

Added: planet/planet/tests/test_sanitize.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/tests/test_sub.py
==============================================================================
--- (empty file)
+++ planet/planet/tests/test_sub.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+import os, glob, unittest
+from ConfigParser import ConfigParser
+from StringIO import StringIO
+import planet
+
+class SubTest(unittest.TestCase):
+    
+    def setUp(self):
+        planet.logging.basicConfig()
+        self.config = ConfigParser()
+        self.config.add_section('Planet')
+        self.config.set('Planet', 'cache_directory', 'planet/tests/data/cache')
+        self.my_planet = planet.Planet(self.config)
+
+    def tearDown(self):
+        for file in glob.glob('planet/tests/data/cache/*'):
+            os.unlink(file)
+        os.removedirs('planet/tests/data/cache')
+
+    def test_fetch(self):
+        self.config.readfp(StringIO("""[planet/tests/data/before.atom]
+name = Test Feed
+"""))
+        self.my_planet.run("test", "http://example.com", [], 0)
+        channels, channels_list = self.my_planet.gather_channel_info()
+        self.assertEqual(len(channels_list), 1)
+        self.assertEqual(channels_list[0]['configured_url'],
+            'planet/tests/data/before.atom')
+
+        items_list = self.my_planet.gather_items_info(channels)
+        self.assertEqual(len(items_list), 1)
+        self.assertEqual(items_list[0]['summary'],'Some text.')
+        self.assertEqual(items_list[0]['date_iso'],'2003-12-13T18:30:02+00:00')
+
+    # this test is actually per the Atom spec definition of 'updated'
+    def test_update_with_new_date(self):
+        self.config.readfp(StringIO("""[planet/tests/data/before.atom]
+name = Test Feed
+"""))
+        self.my_planet.run("test", "http://example.com", [], 0)
+        channels, channels_list = self.my_planet.gather_channel_info()
+
+        channel = channels.keys()[0]
+        channel.url = 'planet/tests/data/after.atom'
+        os.link('planet/tests/data/cache/planet,tests,data,before.atom',
+                'planet/tests/data/cache/planet,tests,data,after.atom')
+        channel.update()
+
+        items_list = self.my_planet.gather_items_info(channels)
+        self.assertEqual(len(items_list), 1)
+        self.assertEqual(items_list[0]['summary'],'Updated text.')
+        self.assertEqual(items_list[0]['date_iso'],'2006-05-21T18:54:02+00:00')
+
+    def test_update_with_no_date(self):
+        self.config.readfp(StringIO("""[planet/tests/data/before.rss]
+name = Test Feed
+"""))
+        self.my_planet.run("test", "http://example.com", [], 0)
+
+        channels, channels_list = self.my_planet.gather_channel_info()
+        channel = channels.keys()[0]
+        item=channel._items.values()[0]
+        item.set_as_date('date',(2003, 12, 13, 18, 30, 2, 5, 347, 0))
+
+        channel.url = 'planet/tests/data/after.rss'
+        os.link('planet/tests/data/cache/planet,tests,data,before.rss',
+                'planet/tests/data/cache/planet,tests,data,after.rss')
+        items_list = self.my_planet.gather_items_info(channels)
+        self.assertEqual(items_list[0]['date_iso'],'2003-12-13T18:30:02+00:00')
+        channel.update()
+
+        items_list = self.my_planet.gather_items_info(channels)
+        self.assertEqual(len(items_list), 1)
+        self.assertEqual(items_list[0]['summary'],'Updated text.')
+        self.assertEqual(items_list[0]['date_iso'],'2003-12-13T18:30:02+00:00')
+
+if __name__ == '__main__':
+    unittest.main()

Added: planet/planet/tests/test_sub.pyc
==============================================================================
Binary file. No diff available.

Added: planet/planet/timeoutsocket.py
==============================================================================
--- (empty file)
+++ planet/planet/timeoutsocket.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,424 @@
+
+####
+# Copyright 2000,2001 by Timothy O'Malley <timo at alum.mit.edu>
+# 
+#                All Rights Reserved
+# 
+# Permission to use, copy, modify, and distribute this software
+# and its documentation for any purpose and without fee is hereby
+# granted, provided that the above copyright notice appear in all
+# copies and that both that copyright notice and this permission
+# notice appear in supporting documentation, and that the name of
+# Timothy O'Malley  not be used in advertising or publicity
+# pertaining to distribution of the software without specific, written
+# prior permission. 
+# 
+# Timothy O'Malley DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+# SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS, IN NO EVENT SHALL Timothy O'Malley BE LIABLE FOR
+# ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE. 
+#
+####
+
+"""Timeout Socket
+
+This module enables a timeout mechanism on all TCP connections.  It
+does this by inserting a shim into the socket module.  After this module
+has been imported, all socket creation goes through this shim.  As a
+result, every TCP connection will support a timeout.
+
+The beauty of this method is that it immediately and transparently
+enables the entire python library to support timeouts on TCP sockets.
+As an example, if you wanted to SMTP connections to have a 20 second
+timeout:
+
+    import timeoutsocket
+    import smtplib
+    timeoutsocket.setDefaultSocketTimeout(20)
+
+
+The timeout applies to the socket functions that normally block on
+execution:  read, write, connect, and accept.  If any of these 
+operations exceeds the specified timeout, the exception Timeout
+will be raised.
+
+The default timeout value is set to None.  As a result, importing
+this module does not change the default behavior of a socket.  The
+timeout mechanism only activates when the timeout has been set to
+a numeric value.  (This behavior mimics the behavior of the
+select.select() function.)
+
+This module implements two classes: TimeoutSocket and TimeoutFile.
+
+The TimeoutSocket class defines a socket-like object that attempts to
+avoid the condition where a socket may block indefinitely.  The
+TimeoutSocket class raises a Timeout exception whenever the
+current operation delays too long. 
+
+The TimeoutFile class defines a file-like object that uses the TimeoutSocket
+class.  When the makefile() method of TimeoutSocket is called, it returns
+an instance of a TimeoutFile.
+
+Each of these objects adds two methods to manage the timeout value:
+
+    get_timeout()   -->  returns the timeout of the socket or file
+    set_timeout()   -->  sets the timeout of the socket or file
+
+
+As an example, one might use the timeout feature to create httplib
+connections that will timeout after 30 seconds:
+
+    import timeoutsocket
+    import httplib
+    H = httplib.HTTP("www.python.org")
+    H.sock.set_timeout(30)
+
+Note:  When used in this manner, the connect() routine may still
+block because it happens before the timeout is set.  To avoid
+this, use the 'timeoutsocket.setDefaultSocketTimeout()' function.
+
+Good Luck!
+
+"""
+
+__version__ = "$Revision: 1.1.1.1 $"
+__author__  = "Timothy O'Malley <timo at alum.mit.edu>"
+
+#
+# Imports
+#
+import select, string
+import socket
+if not hasattr(socket, "_no_timeoutsocket"):
+    _socket = socket.socket
+else:
+    _socket = socket._no_timeoutsocket
+
+
+#
+# Set up constants to test for Connected and Blocking operations.
+# We delete 'os' and 'errno' to keep our namespace clean(er).
+# Thanks to Alex Martelli and G. Li for the Windows error codes.
+#
+import os
+if os.name == "nt":
+    _IsConnected = ( 10022, 10056 )
+    _ConnectBusy = ( 10035, )
+    _AcceptBusy  = ( 10035, )
+else:
+    import errno
+    _IsConnected = ( errno.EISCONN, )
+    _ConnectBusy = ( errno.EINPROGRESS, errno.EALREADY, errno.EWOULDBLOCK )
+    _AcceptBusy  = ( errno.EAGAIN, errno.EWOULDBLOCK )
+    del errno
+del os
+
+
+#
+# Default timeout value for ALL TimeoutSockets
+#
+_DefaultTimeout = None
+def setDefaultSocketTimeout(timeout):
+    global _DefaultTimeout
+    _DefaultTimeout = timeout
+def getDefaultSocketTimeout():
+    return _DefaultTimeout
+
+#
+# Exceptions for socket errors and timeouts
+#
+Error = socket.error
+class Timeout(Exception):
+    pass
+
+
+#
+# Factory function
+#
+from socket import AF_INET, SOCK_STREAM
+def timeoutsocket(family=AF_INET, type=SOCK_STREAM, proto=None):
+    if family != AF_INET or type != SOCK_STREAM:
+        if proto:
+            return _socket(family, type, proto)
+        else:
+            return _socket(family, type)
+    return TimeoutSocket( _socket(family, type), _DefaultTimeout )
+# end timeoutsocket
+
+#
+# The TimeoutSocket class definition
+#
+class TimeoutSocket:
+    """TimeoutSocket object
+    Implements a socket-like object that raises Timeout whenever
+    an operation takes too long.
+    The definition of 'too long' can be changed using the
+    set_timeout() method.
+    """
+
+    _copies = 0
+    _blocking = 1
+    
+    def __init__(self, sock, timeout):
+        self._sock     = sock
+        self._timeout  = timeout
+    # end __init__
+
+    def __getattr__(self, key):
+        return getattr(self._sock, key)
+    # end __getattr__
+
+    def get_timeout(self):
+        return self._timeout
+    # end set_timeout
+
+    def set_timeout(self, timeout=None):
+        self._timeout = timeout
+    # end set_timeout
+
+    def setblocking(self, blocking):
+        self._blocking = blocking
+        return self._sock.setblocking(blocking)
+    # end set_timeout
+
+    def connect_ex(self, addr):
+        errcode = 0
+        try:
+            self.connect(addr)
+        except Error, why:
+            errcode = why[0]
+        return errcode
+    # end connect_ex
+        
+    def connect(self, addr, port=None, dumbhack=None):
+        # In case we were called as connect(host, port)
+        if port != None:  addr = (addr, port)
+
+        # Shortcuts
+        sock    = self._sock
+        timeout = self._timeout
+        blocking = self._blocking
+
+        # First, make a non-blocking call to connect
+        try:
+            sock.setblocking(0)
+            sock.connect(addr)
+            sock.setblocking(blocking)
+            return
+        except Error, why:
+            # Set the socket's blocking mode back
+            sock.setblocking(blocking)
+            
+            # If we are not blocking, re-raise
+            if not blocking:
+                raise
+            
+            # If we are already connected, then return success.
+            # If we got a genuine error, re-raise it.
+            errcode = why[0]
+            if dumbhack and errcode in _IsConnected:
+                return
+            elif errcode not in _ConnectBusy:
+                raise
+            
+        # Now, wait for the connect to happen
+        # ONLY if dumbhack indicates this is pass number one.
+        #   If select raises an error, we pass it on.
+        #   Is this the right behavior?
+        if not dumbhack:
+            r,w,e = select.select([], [sock], [], timeout)
+            if w:
+                return self.connect(addr, dumbhack=1)
+
+        # If we get here, then we should raise Timeout
+        raise Timeout("Attempted connect to %s timed out." % str(addr) )
+    # end connect
+
+    def accept(self, dumbhack=None):
+        # Shortcuts
+        sock     = self._sock
+        timeout  = self._timeout
+        blocking = self._blocking
+
+        # First, make a non-blocking call to accept
+        #  If we get a valid result, then convert the
+        #  accept'ed socket into a TimeoutSocket.
+        # Be carefult about the blocking mode of ourselves.
+        try:
+            sock.setblocking(0)
+            newsock, addr = sock.accept()
+            sock.setblocking(blocking)
+            timeoutnewsock = self.__class__(newsock, timeout)
+            timeoutnewsock.setblocking(blocking)
+            return (timeoutnewsock, addr)
+        except Error, why:
+            # Set the socket's blocking mode back
+            sock.setblocking(blocking)
+
+            # If we are not supposed to block, then re-raise
+            if not blocking:
+                raise
+            
+            # If we got a genuine error, re-raise it.
+            errcode = why[0]
+            if errcode not in _AcceptBusy:
+                raise
+            
+        # Now, wait for the accept to happen
+        # ONLY if dumbhack indicates this is pass number one.
+        #   If select raises an error, we pass it on.
+        #   Is this the right behavior?
+        if not dumbhack:
+            r,w,e = select.select([sock], [], [], timeout)
+            if r:
+                return self.accept(dumbhack=1)
+
+        # If we get here, then we should raise Timeout
+        raise Timeout("Attempted accept timed out.")
+    # end accept
+
+    def send(self, data, flags=0):
+        sock = self._sock
+        if self._blocking:
+            r,w,e = select.select([],[sock],[], self._timeout)
+            if not w:
+                raise Timeout("Send timed out")
+        return sock.send(data, flags)
+    # end send
+
+    def recv(self, bufsize, flags=0):
+        sock = self._sock
+        if self._blocking:
+            r,w,e = select.select([sock], [], [], self._timeout)
+            if not r:
+                raise Timeout("Recv timed out")
+        return sock.recv(bufsize, flags)
+    # end recv
+
+    def makefile(self, flags="r", bufsize=-1):
+        self._copies = self._copies +1
+        return TimeoutFile(self, flags, bufsize)
+    # end makefile
+
+    def close(self):
+        if self._copies <= 0:
+            self._sock.close()
+        else:
+            self._copies = self._copies -1
+    # end close
+
+# end TimeoutSocket
+
+
+class TimeoutFile:
+    """TimeoutFile object
+    Implements a file-like object on top of TimeoutSocket.
+    """
+    
+    def __init__(self, sock, mode="r", bufsize=4096):
+        self._sock          = sock
+        self._bufsize       = 4096
+        if bufsize > 0: self._bufsize = bufsize
+        if not hasattr(sock, "_inqueue"): self._sock._inqueue = ""
+
+    # end __init__
+
+    def __getattr__(self, key):
+        return getattr(self._sock, key)
+    # end __getattr__
+
+    def close(self):
+        self._sock.close()
+        self._sock = None
+    # end close
+    
+    def write(self, data):
+        self.send(data)
+    # end write
+
+    def read(self, size=-1):
+        _sock = self._sock
+        _bufsize = self._bufsize
+        while 1:
+            datalen = len(_sock._inqueue)
+            if datalen >= size >= 0:
+                break
+            bufsize = _bufsize
+            if size > 0:
+                bufsize = min(bufsize, size - datalen )
+            buf = self.recv(bufsize)
+            if not buf:
+                break
+            _sock._inqueue = _sock._inqueue + buf
+        data = _sock._inqueue
+        _sock._inqueue = ""
+        if size > 0 and datalen > size:
+            _sock._inqueue = data[size:]
+            data = data[:size]
+        return data
+    # end read
+
+    def readline(self, size=-1):
+        _sock = self._sock
+        _bufsize = self._bufsize
+        while 1:
+            idx = string.find(_sock._inqueue, "\n")
+            if idx >= 0:
+                break
+            datalen = len(_sock._inqueue)
+            if datalen >= size >= 0:
+                break
+            bufsize = _bufsize
+            if size > 0:
+                bufsize = min(bufsize, size - datalen )
+            buf = self.recv(bufsize)
+            if not buf:
+                break
+            _sock._inqueue = _sock._inqueue + buf
+
+        data = _sock._inqueue
+        _sock._inqueue = ""
+        if idx >= 0:
+            idx = idx + 1
+            _sock._inqueue = data[idx:]
+            data = data[:idx]
+        elif size > 0 and datalen > size:
+            _sock._inqueue = data[size:]
+            data = data[:size]
+        return data
+    # end readline
+
+    def readlines(self, sizehint=-1):
+        result = []
+        data = self.read()
+        while data:
+            idx = string.find(data, "\n")
+            if idx >= 0:
+                idx = idx + 1
+                result.append( data[:idx] )
+                data = data[idx:]
+            else:
+                result.append( data )
+                data = ""
+        return result
+    # end readlines
+
+    def flush(self):  pass
+
+# end TimeoutFile
+
+
+#
+# Silently replace the socket() builtin function with
+# our timeoutsocket() definition.
+#
+if not hasattr(socket, "_no_timeoutsocket"):
+    socket._no_timeoutsocket = socket.socket
+    socket.socket = timeoutsocket
+del socket
+socket = timeoutsocket
+# Finis

Added: planet/planet/timeoutsocket.pyc
==============================================================================
Binary file. No diff available.

Added: planet/runtests.py
==============================================================================
--- (empty file)
+++ planet/runtests.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,11 @@
+#!/usr/bin/env python
+import glob, trace, unittest
+
+# find all of the planet test modules
+modules = map(trace.fullmodname, glob.glob('planet/tests/test_*.py'))
+
+# load all of the tests into a suite
+suite = unittest.TestLoader().loadTestsFromNames(modules)
+
+# run test suite
+unittest.TextTestRunner().run(suite)

Added: planet/setup.py
==============================================================================
--- (empty file)
+++ planet/setup.py	Wed Apr  4 17:08:45 2007
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+"""The Planet Feed Aggregator"""
+
+import os
+from distutils.core import setup
+
+from planet import __version__ as VERSION
+from planet import __license__ as LICENSE
+
+if 'PLANET_VERSION' in os.environ.keys():
+    VERSION = os.environ['PLANET_VERSION']
+
+setup(name="planet",
+      version=VERSION,
+      description="The Planet Feed Aggregator",
+      author="Planet Developers",
+      author_email="devel at lists.planetplanet.org",
+      url="http://www.planetplanet.org/",
+      license=LICENSE,
+      packages=["planet", "planet.compat_logging", "planet.tests"],
+      scripts=["planet.py", "planet-cache.py", "runtests.py"],
+      )


More information about the pld-cvs-commit mailing list