# HG changeset patch # User Jeff Hammel # Date 1288710336 25200 # Node ID 159d911ad01c8be9a6ff579e55a0aef2be5369f1 initial stub for bitsyapps diff -r 000000000000 -r 159d911ad01c bitsyapps/__init__.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bitsyapps/__init__.py Tue Nov 02 08:05:36 2010 -0700 @@ -0,0 +1,1 @@ +# diff -r 000000000000 -r 159d911ad01c bitsyapps/on.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bitsyapps/on.py Tue Nov 02 08:05:36 2010 -0700 @@ -0,0 +1,36 @@ +import os + +class BitsyDoc(object): + + # TODO: make this work with tagging + + on = 'on ' + separator = '\n--\n\n' + + def __init__(self, bitsyblog, directory): + self.bitsyblog = bitsyblog + self.directory = directory + assert os.path.exists(directory) + + def __call__(self, blog_entry, url): + title = blog_entry.title() + if ':' in title and title.startswith(self.on): + subject, title = title.split(':', 1) + subject = subject[len(self.on):].lower() + full_subject = self.on + subject + ':' + + # XXX single-word subjects, for now + + filename = subject + '.txt' + filename = os.path.join(self.directory, filename) + + exists = os.path.exists(filename) + + f = file(filename, 'a') + if exists: + print >> f, self.separator + + body = blog_entry.body.split(full_subject, 1)[-1].strip() + + print >> f, body + f.close() diff -r 000000000000 -r 159d911ad01c setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Tue Nov 02 08:05:36 2010 -0700 @@ -0,0 +1,26 @@ +from setuptools import setup, find_packages +import sys, os + +version = '0.0' + +setup(name='bitsyapps', + version=version, + description="pluggable applications for bitsyblog POST events", + long_description="""\ +""", + classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers + keywords='', + author='Jeff Hammel', + author_email='jhammel@mozilla.com', + url='http://k0s.org/', + license='GPL', + packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), + include_package_data=True, + zip_safe=False, + install_requires=[ + # -*- Extra requirements: -*- + ], + entry_points=""" + # -*- Entry points: -*- + """, + )