Merge pull request #110 from kmike/master

Python 2.5 compatibility, executable setup.py and up-to-date docstrings. (thanks kmike)
This commit is contained in:
Alexis Metaireau 2011-05-07 11:35:19 -07:00
commit 1baca77f3a
4 changed files with 24 additions and 18 deletions

View file

@ -6,8 +6,7 @@ class Page(object):
"""Represents a page """Represents a page
Given a content, and metadatas, create an adequate object. Given a content, and metadatas, create an adequate object.
:param string: the string to parse, containing the original content. :param content: the string to parse, containing the original content.
:param markup: the markup language to use while parsing.
""" """
mandatory_properties = ('title',) mandatory_properties = ('title',)
@ -90,6 +89,6 @@ def is_valid_content(content, f):
try: try:
content.check_properties() content.check_properties()
return True return True
except NameError as e: except NameError, e:
error(u"Skipping %s: impossible to find informations about '%s'" % (f, e)) error(u"Skipping %s: impossible to find informations about '%s'" % (f, e))
return False return False

View file

@ -63,7 +63,13 @@ class Generator(object):
extensions = self.markup extensions = self.markup
files = [] files = []
for root, dirs, temp_files in os.walk(path, followlinks=True):
try:
iter = os.walk(path, followlinks=True)
except TypeError: # python 2.5 does not support followlinks
iter = os.walk(path)
for root, dirs, temp_files in iter:
for e in exclude: for e in exclude:
if e in dirs: if e in dirs:
dirs.remove(e) dirs.remove(e)

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import with_statement
import os import os
import re import re
from codecs import open from codecs import open
@ -44,9 +45,8 @@ class Writer(object):
Return the feed. If no output_path or filename is specified, just return Return the feed. If no output_path or filename is specified, just return
the feed object. the feed object.
:param articles: the articles to put on the feed. :param elements: the articles to put on the feed.
:param context: the context to get the feed metadata. :param context: the context to get the feed metadata.
:param output_path: where to output the file.
:param filename: the filename to output. :param filename: the filename to output.
:param feed_type: the feed type to use (atom or rss) :param feed_type: the feed type to use (atom or rss)
""" """

1
setup.py Normal file → Executable file
View file

@ -1,3 +1,4 @@
#!/usr/bin/env python
from setuptools import setup from setuptools import setup
import sys import sys