+++ /dev/null
-This file is for you to describe the wrfeed application. Typically
-you would include information such as the information below:
-
-Installation and Setup
-======================
-
-Install ``wrfeed`` using easy_install::
-
- easy_install wrfeed
-
-Make a config file as follows::
-
- paster make-config wrfeed config.ini
-
-Tweak the config file as appropriate and then setup the application::
-
- paster setup-app config.ini
-
-Then you are ready to go.
+++ /dev/null
-feed
-++++
-
-This is the main index page of your documentation. It should be written in
-`reStructuredText format <http://docutils.sourceforge.net/rst.html>`_.
-
-You can generate your documentation in HTML format by running this command::
-
- setup.py pudge
-
-For this to work you will need to download and install `buildutils`_,
-`pudge`_, and `pygments`_. The ``pudge`` command is disabled by
-default; to ativate it in your project, run::
-
- setup.py addcommand -p buildutils.pudge_command
-
-.. _buildutils: http://pypi.python.org/pypi/buildutils
-.. _pudge: http://pudge.lesscode.org/
-.. _pygments: http://pygments.org/
+++ /dev/null
-[egg_info]
-tag_build = dev
-tag_svn_revision = true
-
-[easy_install]
-find_links = http://www.pylonshq.com/download/
-
-[nosetests]
-with-pylons = test.ini
-
-# Babel configuration
-[compile_catalog]
-domain = wrfeed
-directory = wrfeed/i18n
-statistics = true
-
-[extract_messages]
-add_comments = TRANSLATORS:
-output_file = wrfeed/i18n/wrfeed.pot
-width = 80
-
-[init_catalog]
-domain = wrfeed
-input_file = wrfeed/i18n/wrfeed.pot
-output_dir = wrfeed/i18n
-
-[update_catalog]
-domain = wrfeed
-input_file = wrfeed/i18n/wrfeed.pot
-output_dir = wrfeed/i18n
-previous = true
+++ /dev/null
-#
-# wrfeed - Pylons configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-email_to = you@yourdomain.com
-smtp_server = localhost
-error_email_from = paste@localhost
-
-[server:main]
-use = egg:Paste#http
-host = 127.0.0.1
-port = 5000
-
-[app:main]
-use = egg:wrfeed
-full_stack = true
-static_files = true
-
-cache_dir = %(here)s/data
-beaker.session.key = wrfeed
-beaker.session.secret = ${app_instance_secret}
-app_instance_uuid = ${app_instance_uuid}
-
-# If you'd like to fine-tune the individual locations of the cache data dirs
-# for the Cache data, or the Session saves, un-comment the desired settings
-# here:
-#beaker.cache.data_dir = %(here)s/data/cache
-#beaker.session.data_dir = %(here)s/data/sessions
-
-# SQLAlchemy database URL
-sqlalchemy.url = mysql://user@localhost:3306/winterrodeln_wiki?charset=utf8&use_unicode=1
-# sqlalchemy.url = sqlite:///production.db
-
-# necessary for mySQL databases
-sqlalchemy.pool_recycle = 3600
-
-# maximum number of feed entries
-feedentrylimit = 150
-
-# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT*
-# Debug mode will enable the interactive debugging tool, allowing ANYONE to
-# execute malicious code after an exception is raised.
-set debug = false
-
-
-# Logging configuration
-[loggers]
-keys = root
-
-[handlers]
-keys = console
-
-[formatters]
-keys = generic
-
-[logger_root]
-level = INFO
-handlers = console
-
-[handler_console]
-class = StreamHandler
-args = (sys.stderr,)
-level = NOTSET
-formatter = generic
-
-[formatter_generic]
-format = %(asctime)s %(levelname)-5.5s [%(name)s] [%(threadName)s] %(message)s
+++ /dev/null
-"""Pylons environment configuration"""
-import os
-
-from genshi.template import TemplateLoader
-from pylons.configuration import PylonsConfig
-from sqlalchemy import engine_from_config
-
-import wrfeed.lib.app_globals as app_globals
-import wrfeed.lib.helpers
-from wrfeed.config.routing import make_map
-from wrfeed.model import init_model
-
-def load_environment(global_conf, app_conf):
- """Configure the Pylons environment via the ``pylons.config``
- object
- """
- config = PylonsConfig()
-
- # Pylons paths
- root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
- paths = dict(root=root,
- controllers=os.path.join(root, 'controllers'),
- static_files=os.path.join(root, 'public'),
- templates=[os.path.join(root, 'templates')])
-
- # Initialize config with the basic options
- config.init_app(global_conf, app_conf, package='wrfeed', paths=paths)
-
- config['routes.map'] = make_map(config)
- config['pylons.app_globals'] = app_globals.Globals(config)
- config['pylons.h'] = wrfeed.lib.helpers
-
- # Setup cache object as early as possible
- import pylons
- pylons.cache._push_object(config['pylons.app_globals'].cache)
-
-
- # Create the Genshi TemplateLoader
- #config['pylons.app_globals'].genshi_loader = TemplateLoader(
- # paths['templates'], auto_reload=True)
-
- # Setup the SQLAlchemy database engine
- #engine = engine_from_config(config, 'sqlalchemy.')
- #init_model(engine)
-
- # CONFIGURATION OPTIONS HERE (note: all config options will override
- # any Pylons config options)
-
- return config
+++ /dev/null
-"""Pylons middleware initialization"""
-from beaker.middleware import SessionMiddleware
-from paste.cascade import Cascade
-from paste.registry import RegistryManager
-from paste.urlparser import StaticURLParser
-from paste.deploy.converters import asbool
-from pylons.middleware import ErrorHandler, StatusCodeRedirect
-from pylons.wsgiapp import PylonsApp
-from routes.middleware import RoutesMiddleware
-
-from wrfeed.config.environment import load_environment
-
-def make_app(global_conf, full_stack=True, static_files=True, **app_conf):
- """Create a Pylons WSGI application and return it
-
- ``global_conf``
- The inherited configuration for this application. Normally from
- the [DEFAULT] section of the Paste ini file.
-
- ``full_stack``
- Whether this application provides a full WSGI stack (by default,
- meaning it handles its own exceptions and errors). Disable
- full_stack when this application is "managed" by another WSGI
- middleware.
-
- ``static_files``
- Whether this application serves its own static files; disable
- when another web server is responsible for serving them.
-
- ``app_conf``
- The application's local configuration. Normally specified in
- the [app:<name>] section of the Paste ini file (where <name>
- defaults to main).
-
- """
- # Configure the Pylons environment
- config = load_environment(global_conf, app_conf)
-
- # The Pylons WSGI app
- app = PylonsApp(config=config)
-
- # Routing/Session Middleware
- app = RoutesMiddleware(app, config['routes.map'])
- app = SessionMiddleware(app, config)
-
- # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares)
-
- if asbool(full_stack):
- # Handle Python exceptions
- app = ErrorHandler(app, global_conf, **config['pylons.errorware'])
-
- # Display error documents for 401, 403, 404 status codes (and
- # 500 when debug is disabled)
- if asbool(config['debug']):
- app = StatusCodeRedirect(app)
- else:
- app = StatusCodeRedirect(app, [400, 401, 403, 404, 500])
-
- # Establish the Registry for this application
- app = RegistryManager(app)
-
- if asbool(static_files):
- # Serve static files
- static_app = StaticURLParser(config['pylons.paths']['static_files'])
- app = Cascade([static_app, app])
- app.config = config
- return app
+++ /dev/null
-"""Routes configuration
-
-The more specific and detailed routes should be defined first so they
-may take precedent over the more generic routes. For more information
-refer to the routes manual at http://routes.groovie.org/docs/
-
-Format:
- http://www.winterrodeln.org/feed/berichte/alle
- http://www.winterrodeln.org/feed/berichte/bahn/kemater_alm
- http://www.winterrodeln.org/feed/berichte/bahnen/22+42+132
-See:
- http://www.winterrodeln.org/trac/wiki/UrlSchema
-"""
-from routes import Mapper
-
-def make_map(config):
- """Create, configure and return the routes Mapper"""
- map = Mapper(directory=config['pylons.paths']['controllers'],
- always_scan=config['debug'])
- map.minimization = False
- map.explicit = False
-
- # The ErrorController route (handles 404/500 error pages); it should
- # likely stay at the top, ensuring it can always be resolved
- map.connect('/error/{action}', controller='error')
- map.connect('/error/{action}/{id}', controller='error')
-
- # CUSTOM ROUTES HERE
-
- map.connect('/berichte/alle', controller='berichte', action='alle')
- map.connect('/berichte/{action}/{id}', controller='berichte')
-
- return map
+++ /dev/null
-import cgi
-
-from paste.urlparser import PkgResourcesParser
-from pylons import request
-from pylons.controllers.util import forward
-from pylons.middleware import error_document_template
-from webhelpers.html.builder import literal
-
-from wrfeed.lib.base import BaseController
-
-class ErrorController(BaseController):
-
- """Generates error documents as and when they are required.
-
- The ErrorDocuments middleware forwards to ErrorController when error
- related status codes are returned from the application.
-
- This behaviour can be altered by changing the parameters to the
- ErrorDocuments middleware in your config/middleware.py file.
-
- """
-
- def document(self):
- """Render the error document"""
- resp = request.environ.get('pylons.original_response')
- content = literal(resp.body) or cgi.escape(request.GET.get('message', ''))
- page = error_document_template % \
- dict(prefix=request.environ.get('SCRIPT_NAME', ''),
- code=cgi.escape(request.GET.get('code', str(resp.status_int))),
- message=content)
- return page
-
- def img(self, id):
- """Serve Pylons' stock images"""
- return self._serve_file('/'.join(['media/img', id]))
-
- def style(self, id):
- """Serve Pylons' stock stylesheets"""
- return self._serve_file('/'.join(['media/style', id]))
-
- def _serve_file(self, path):
- """Call Paste's FileApp (a WSGI application) to serve the file
- at the specified path
- """
- request.environ['PATH_INFO'] = '/%s' % path
- return forward(PkgResourcesParser('pylons', 'pylons'))
+++ /dev/null
-"""The application's Globals object"""
-
-from beaker.cache import CacheManager
-from beaker.util import parse_cache_config_options
-
-class Globals(object):
-
- """Globals acts as a container for objects available throughout the
- life of the application
-
- """
-
- def __init__(self, config):
- """One instance of Globals is created during application
- initialization and is available during requests via the
- 'app_globals' variable
-
- """
- self.cache = CacheManager(**parse_cache_config_options(config))
+++ /dev/null
-"""The base Controller API
-
-Provides the BaseController class for subclassing.
-"""
-from pylons.controllers import WSGIController
-from pylons.templating import render_genshi as render
-
-from wrfeed.model.meta import Session
-
-class BaseController(WSGIController):
-
- def __call__(self, environ, start_response):
- """Invoke the Controller"""
- # WSGIController.__call__ dispatches to the Controller method
- # the request is routed to. This routing information is
- # available in environ['pylons.routes_dict']
- try:
- return WSGIController.__call__(self, environ, start_response)
- finally:
- Session.remove()
+++ /dev/null
-"""Helper functions
-
-Consists of functions to typically be used within templates, but also
-available to Controllers. This module is available to templates as 'h'.
-"""
-# Import helpers as desired, or define your own, ie:
-#from webhelpers.html.tags import checkbox, password
+++ /dev/null
-"""The application's model objects"""
-from wrfeed.model.meta import Session, metadata
-
-
-def init_model(engine):
- """Call me before using any of the tables or classes in the model"""
- Session.configure(bind=engine)
+++ /dev/null
-"""SQLAlchemy Metadata and Session object"""
-from sqlalchemy import MetaData
-from sqlalchemy.orm import scoped_session, sessionmaker
-
-__all__ = ['Session', 'metadata']
-
-# SQLAlchemy session manager. Updated by model.init_model()
-Session = scoped_session(sessionmaker())
-
-# Global metadata. If you have multiple databases with overlapping table
-# names, you'll need a metadata for each database
-metadata = MetaData()
+++ /dev/null
-"""Setup the wrfeed application"""
-import logging
-
-import pylons.test
-
-from wrfeed.config.environment import load_environment
-from wrfeed.model.meta import Session, metadata
-
-log = logging.getLogger(__name__)
-
-def setup_app(command, conf, vars):
- """Place any commands to setup wrfeed here"""
- # Don't reload the app if it was loaded under the testing environment
- if not pylons.test.pylonsapp:
- load_environment(conf.global_conf, conf.local_conf)
-
- # Create the tables if they don't already exist
- metadata.create_all(bind=Session.bind)