Commits

Rufus Pollock committed 78b2a93

[all][l]: remove all existing files (mainly pylons app) except README.txt.

Comments (0)

Files changed (32)

MANIFEST.in

-include commentonit/config/deployment.ini_tmpl
-recursive-include commentonit/public *
-recursive-include commentonit/templates *

commentonit/__init__.py

Empty file removed.

commentonit/config/__init__.py

Empty file removed.

commentonit/config/deployment.ini_tmpl

-#
-# commentonit - 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 = 0.0.0.0
-port = 5000
-
-[app:main]
-use = egg:commentonit
-full_stack = true
-static_files = true
-
-cache_dir = %(here)s/data
-beaker.session.key = commentonit
-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 = sqlite:///production.db
-
-# 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] %(message)s

commentonit/config/environment.py

-"""Pylons environment configuration"""
-import os
-
-from genshi.template import TemplateLoader
-from pylons import config
-from sqlalchemy import engine_from_config
-
-import commentonit.lib.app_globals as app_globals
-import commentonit.lib.helpers
-from commentonit.config.routing import make_map
-from commentonit.model import init_model
-
-def load_environment(global_conf, app_conf):
-    """Configure the Pylons environment via the ``pylons.config``
-    object
-    """
-    # 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='commentonit', paths=paths)
-
-    config['routes.map'] = make_map()
-    config['pylons.app_globals'] = app_globals.Globals()
-    config['pylons.h'] = commentonit.lib.helpers
-
-    # 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)

commentonit/config/middleware.py

-"""Pylons middleware initialization"""
-from beaker.middleware import CacheMiddleware, SessionMiddleware
-from paste.cascade import Cascade
-from paste.registry import RegistryManager
-from paste.urlparser import StaticURLParser
-from paste.deploy.converters import asbool
-from pylons import config
-from pylons.middleware import ErrorHandler, StatusCodeRedirect
-from pylons.wsgiapp import PylonsApp
-from routes.middleware import RoutesMiddleware
-
-from commentonit.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
-    load_environment(global_conf, app_conf)
-
-    # The Pylons WSGI app
-    app = PylonsApp()
-
-    # Routing/Session/Cache Middleware
-    app = RoutesMiddleware(app, config['routes.map'])
-    app = SessionMiddleware(app, config)
-    app = CacheMiddleware(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])
-
-    return app

commentonit/config/routing.py

-"""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/
-"""
-from pylons import config
-from routes import Mapper
-
-def make_map():
-    """Create, configure and return the routes Mapper"""
-    map = Mapper(directory=config['pylons.paths']['controllers'],
-                 always_scan=config['debug'])
-    map.minimization = 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('home', '/', controller='home', action='index')
-    map.connect('annotate', '/annotate', controller='home', action='annotate')
-    # need both of these for e.g. the annotation store ...
-    # /annotation/ (used in GET) and /annotation used in PUT
-    map.connect('/{controller}')
-    map.connect('/{controller}/')
-    map.connect('/{controller}/{action}')
-    map.connect('/{controller}/{action}/{id}')
-
-    return map

commentonit/controllers/__init__.py

Empty file removed.

commentonit/controllers/annotation.py

-import logging
-
-from pylons import request, response, session, tmpl_context as c
-from pylons.controllers.util import abort, redirect_to
-
-from commentonit.lib.base import BaseController, render
-
-log = logging.getLogger(__name__)
-
-from annotator.store import AnnotatorStore
-
-# mounting it at annotation in pylons is a bit 'clever'
-# we're not stripping off script_name at the moment from path
-# and annotation is the offset within Store for annotation objects
-AnnotationController = AnnotatorStore
-

commentonit/controllers/error.py

-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 commentonit.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'))

commentonit/controllers/home.py

-import logging
-
-from pylons import request, response, session, tmpl_context as c
-from pylons.controllers.util import abort, redirect_to
-
-from commentonit.lib.base import BaseController, render
-
-log = logging.getLogger(__name__)
-
-import annotator.middleware
-media_mount_path = '/jsannotate'
-server_api = '/'
-anno_middleware = annotator.middleware.JsAnnotateMiddleware(None,
-        media_mount_path, server_api)
-
-class HomeController(BaseController):
-
-    def index(self):
-        return render('index.html')
-
-    def annotate(self):
-        c.prefix = server_api + 'annotation'
-        c.uri = 'make one up'
-        # TODO: create text in the backend ...
-        text = request.params.get('text', '')
-        import webhelpers.markdown as md
-        if text:
-            c.content = md.markdown(text)
-        else:
-            c.content = ''
-        out = render('annotate.html')
-        # out is a webhelpers.html.builder.literal
-        # we want to work with raw html ...
-        out = anno_middleware.modify_html(unicode(out))
-        return out
-

commentonit/lib/__init__.py

Empty file removed.

commentonit/lib/app_globals.py

-"""The application's Globals object"""
-
-class Globals(object):
-
-    """Globals acts as a container for objects available throughout the
-    life of the application
-
-    """
-
-    def __init__(self):
-        """One instance of Globals is created during application
-        initialization and is available during requests via the
-        'app_globals' variable
-
-        """

commentonit/lib/base.py

-"""The base Controller API
-
-Provides the BaseController class for subclassing.
-"""
-from pylons.controllers import WSGIController
-from pylons.templating import render_genshi as render
-
-from commentonit.model import meta
-
-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:
-            meta.Session.remove()

commentonit/lib/cli.py

-import os
-
-import paste.script
-
-class CkanCommand(paste.script.command.Command):
-    parser = paste.script.command.Command.standard_parser(verbose=True)
-    parser.add_option('-c', '--config', dest='config',
-            default='development.ini', help='Config file to use.')
-    default_verbosity = 1
-    group_name = 'commentonit'
-
-    def _load_config(self):
-        from paste.deploy import appconfig
-        from commentonit.config.environment import load_environment
-        if not self.options.config:
-            msg = 'No config file supplied'
-            raise self.BadCommand(msg)
-        self.filename = os.path.abspath(self.options.config)
-        conf = appconfig('config:' + self.filename)
-        load_environment(conf.global_conf, conf.local_conf)
-
-    def _setup_app(self):
-        cmd = paste.script.appinstall.SetupCommand('setup-app') 
-        cmd.run([self.filename]) 
-
-
-class ManageDb(CkanCommand):
-    '''Perform various tasks on the database.
-    '''
-    summary = __doc__.split('\n')[0]
-    usage = __doc__
-    max_args = None
-    min_args = 1
-
-    def command(self):
-        self._load_config()
-        from commentonit import model
-
-        cmd = self.args[0]
-        if cmd == 'create':
-            model.repo.create_db()
-        elif cmd == 'init':
-            model.repo.init_db()
-        elif cmd == 'clean':
-            model.repo.clean_db()
-        else:
-            print 'Command %s not recognized' % cmd
-

commentonit/lib/helpers.py

-"""Helper functions
-
-Consists of functions to typically be used within templates, but also
-available to Controllers. This module is available to templates as 'h'.
-"""
-from webhelpers.html.tags import *
-from routes import url_for
-from genshi import HTML
-

commentonit/model/__init__.py

-"""The application's model objects"""
-from datetime import datetime
-
-import sqlalchemy as sa
-from sqlalchemy import orm
-
-from commentonit.model import meta
-from meta import Session
-from sqlalchemy.orm import mapper
-from sqlalchemy.ext.declarative import declarative_base
-Base = declarative_base(metadata=meta.metadata)
-
-def init_model(engine):
-    """Call me before using any of the tables or classes in the model"""
-    ## Reflected tables must be defined and mapped here
-    #global reflected_table
-    #reflected_table = sa.Table("Reflected", meta.metadata, autoload=True,
-    #                           autoload_with=engine)
-    #orm.mapper(Reflected, reflected_table)
-    #
-    meta.Session.configure(bind=engine)
-    meta.engine = engine
-    assert engine is not None
-
-## ---------------------------
-## Annotation stuff
-
-import annotator.model
-annotation_table = annotator.model.make_annotation_table(meta.metadata)
-Annotation = annotator.model.Annotation
-annotator.model.map_annotation_object(mapper, annotation_table)
-# Correct for fact we aren't using Session.mapper but annotator expects it
-# http://www.sqlalchemy.org/trac/wiki/UsageRecipes/SessionAwareMapper
-Annotation.query = Session.query_property()
-
-
-## ---------------------------
-## Our Classes
-
-import uuid
-def make_uuid():
-    return unicode(uuid.uuid4())
-
-# have to define this before its use in Work object
-work_2_user_table = sa.Table('work_2_user', meta.metadata,
-    sa.Column('work_id', sa.types.UnicodeText, sa.ForeignKey('work.id'),
-        primary_key=True),
-    sa.Column('user_id', sa.types.UnicodeText, sa.ForeignKey('user.id'),
-        primary_key=True)
-    )
-
-
-class Work(Base):
-    __tablename__ = 'work'
-
-    id = sa.Column(sa.types.UnicodeText, primary_key=True, default=make_uuid)
-    created = sa.Column(sa.types.DateTime, default=datetime.now())
-    title = sa.Column(sa.types.UnicodeText)
-    uri = sa.Column(sa.types.UnicodeText)
-
-    owners = orm.relation('User', secondary=work_2_user_table, backref='works')
-
-
-class Text(Base):
-    __tablename__ = 'text'
-
-    id = sa.Column(sa.types.UnicodeText, primary_key=True, default=make_uuid)
-    work_id = sa.Column(sa.types.UnicodeText, sa.ForeignKey('work.id'))
-    created = sa.Column(sa.types.DateTime, default=datetime.now())
-    # types: url, (python) package, disk, inline (i.e. stored in payload)
-    payload_type = sa.Column(sa.types.UnicodeText, default=u'db')
-    payload = sa.Column(sa.types.UnicodeText)
-    format = sa.Column(sa.types.UnicodeText)
-
-    work = orm.relation(Work, backref='texts')
-
-    def get_stream(self):
-        '''Get fileobj for content (if any) associated with this text.
-
-        '''
-        if self.payload_type == u'package':
-            package, path = self.payload.split('::')
-            import pkg_resources
-            fileobj = pkg_resources.resource_stream(package, path)
-            return fileobj
-        elif self.payload_type == u'inline':
-            from StringIO import StringIO
-            return StringIO(self.payload)
-        elif self.payload_type == u'disk':
-            fp = open(self.payload)
-            return open(fp)
-        else:
-            raise NotImplementedError
-
-
-class User(Base):
-    __tablename__ = 'user'
-
-    id = sa.Column(sa.types.UnicodeText, primary_key=True, default=make_uuid)
-    name = sa.Column(sa.types.UnicodeText)
-    created = sa.Column(sa.types.DateTime, default=datetime.now())
-
-
-class Repository(object):
-
-    def create_db(self):
-        '''Create the tables if they don't already exist'''
-        meta.metadata.create_all(bind=meta.engine)
-
-    def clean_db(self):
-        meta.metadata.drop_all(bind=meta.engine)
-
-    def init_db(self):
-        pass
-
-    def rebuild_db(self):
-        self.clean_db()
-        self.create_db()
-
-repo = Repository()
-

commentonit/model/meta.py

-"""SQLAlchemy Metadata and Session object"""
-from sqlalchemy import MetaData
-from sqlalchemy.orm import scoped_session, sessionmaker
-
-__all__ = ['Session', 'engine', 'metadata']
-
-# SQLAlchemy database engine. Updated by model.init_model()
-engine = None
-
-# 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()

commentonit/templates/__init__.py

Empty file removed.

commentonit/templates/annotate.html

-<html
-  xmlns:py="http://genshi.edgewall.org/"
-  xmlns:xi="http://www.w3.org/2001/XInclude"
-  py:strip="">
-  
-  <py:def function="page_title">Annotate</py:def>
-
-  <div py:match="content">
-    <div id="text-to-annotate">
-    ${h.HTML(c.content)}
-    </div>
-	</div>
-
-  <xi:include href="layout.html" />
-</html>

commentonit/templates/index.html

-<html
-  xmlns:py="http://genshi.edgewall.org/"
-  xmlns:xi="http://www.w3.org/2001/XInclude"
-  py:strip="">
-  
-  <py:def function="page_title">Home</py:def>
-
-  <div py:match="content">
-    <form action="annotate" method="POST">
-      <!--
-      <label>Upload a file:</label>
-      ${h.file(name='file', size=30)}
-      -->
-
-      <label>Enter some text (you can use <a
-          href="http://daringfireball.net/projects/markdown/">markdown</a>):</label>
-      ${h.textarea(name='text', cols=80, rows=10)}
-
-      <br />
-      <br />
-      ${h.submit('Go &raquo;', 'Go')}
-    </form>
-	</div>
-
-  <xi:include href="layout.html" />
-</html>

commentonit/templates/layout.html

-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html
-  xmlns="http://www.w3.org/1999/xhtml"
-  xmlns:py="http://genshi.edgewall.org/" 
-  xmlns:xi="http://www.w3.org/2001/XInclude"
-  >
-
-<head>
-  <title>Comment on It - ${page_title()}</title>
-  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-  <link rel="stylesheet" href="http://m.okfn.org/kforge/css/master.css" type="text/css" media="screen, print" title="Master stylesheet" charset="utf-8" />
-  <link rel="stylesheet" href="/css/extra.css" type="text/css" media="screen, print" title="Master stylesheet" charset="utf-8" />
-  <link rel="shortcut icon" href="http://m.okfn.org/gfx/logo/favicon.ico" type="image/x-icon" />
-
-  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
-  <script type="text/javascript" src="http://m.okfn.org/kforge/scripts/kforge.js"></script>
-
-  <py:if test="defined('page_specific_css')">
-    ${page_specific_css()}
-  </py:if>
-  <style type="text/css">
-    #top-bar {
-      display: none;
-    }
-
-    #subnav {
-      background: transparent;
-      height: 0px;
-      padding: 0;
-      margin-bottom: -10px;
-    }
-
-  </style>
-</head>
-
-<body>
-<div id="airlock">
-  <!--[if IE]>
-    <hr class="holder" />
-  <![endif]-->
-  <div id="top">
-    <div id="top-inner">
-      <div id="top-bar">
-        <py:choose>
-        <py:when test="False">
-        <p>
-          Logged in as <strong>${}</strong> 
-          | <a href="/account/logout/">Logout</a>
-        </p>
-        </py:when>
-        <py:otherwise>
-          <p>
-          <a href="/account/">Register</a> or
-          <a href="/account/login/">Login</a>
-          </p>
-        </py:otherwise>
-        </py:choose>
-      </div><!-- /top-bar -->
-      
-      <h1>
-        <a href="${h.url_for('home')}" title="Home">Comment on It</a>
-      </h1>
-    
-    </div><!-- /top-inner -->
-     
-    <h3 class="hidden">Sections:</h3>
-    <ul id="navigation">
-			<li><a href="${h.url_for('home')}">Home</a></li>
-    </ul>
-    <h3 class="hidden">In this section:</h3>
-    <ul id="subnav">
-      <minornavigation>
-      </minornavigation>
-    </ul>
-       
-    <!--[if IE]>
-    <hr class="holder" />
-    <![endif]-->
-    
-  </div><!-- /top -->
-  
-  <p class="hidden"><a href="#main" title="Skip to page content">[ Skip to main content ]</a></p> 
-  
-  <div id="primary" class="sidebar">
-    <div class="box">
-      <h2>Using This Service</h2>
-      <p></p>
-    </div>
-    <primarysidebar>
-    <!-- Primary Side Bar Goes Here -->
-    </primarysidebar>
-    
-    <!--[if IE]>
-    <hr class="primary" />
-    <![endif]-->
-    
-  </div><!-- /primary -->
-
-  <div id="main">
-    <content>
-      <p>Master content template placeholder &hellip; please replace me.</p>
-    </content>
-    
-    <div id="footer">
-      <p>
-        <a href="http://validator.w3.org/check/referer" title="Valid XHTML 1.1">XHTML</a>
-        | <a href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a>
-        | <a href="http://www.okfn.org/ckan/">Project Home Page</a>
-        | <a href="mailto:info@okfn.org">Contact Us</a>
-      </p>
-      <p>
-        <img style="margin-bottom: -5px;" src="http://m.okfn.org/images/logo/okf_logo_white_and_green_tiny.png" /> An <a href="http://www.okfn.org/">Open Knowledge Foundation</a> Project
-      </p>
-      <p>
-        (c) Open Knowledge Foundation
-        | All material available under <a href="http://www.opendefinition.org/">open licenses</a> (CC by-sa or MIT)
-        | <a href="http://www.opendefinition.org/1.0/"><img
-            style="border: none; margin-bottom: -4px;"
-            src="http://m.okfn.org/images/ok_buttons/ok_90x15_blue.png"
-            alt="This Content and Data is Open" /></a>
-      </p>
-    </div><!-- /footer -->
-    
-    <!--[if IE]>
-    <hr class="main" />
-    <![endif]-->
-    
-  </div><!-- /main -->
-
-</div><!-- /airlock -->
-
-<!-- Google Analytics -->
-<script type="text/javascript">
-  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-</script>
-<script type="text/javascript">
-try {
-var pageTracker = _gat._getTracker("UA-8271754-7");
-pageTracker._setDomainName(".isitopen.ckan.net");
-pageTracker._trackPageview();
-} catch(err) {}
-</script>
-<!-- Google Analytics -->
-
-</body>
-</html>

commentonit/tests/__init__.py

-"""Pylons application test package
-
-This package assumes the Pylons environment is already loaded, such as
-when this script is imported from the `nosetests --with-pylons=test.ini`
-command.
-
-This module initializes the application via ``websetup`` (`paster
-setup-app`) and provides the base testing objects.
-"""
-from paste.deploy import loadapp
-from paste.script.appinstall import SetupCommand
-from pylons import config, url
-from routes.util import URLGenerator
-from webtest import TestApp
-
-import pylons.test
-
-__all__ = ['environ', 'url', 'TestController']
-
-# Invoke websetup with the current config file
-SetupCommand('setup-app').run([config['__file__']])
-
-environ = {}
-
-class TestController(object):
-
-    def __init__(self, *args, **kwargs):
-        if pylons.test.pylonsapp:
-            wsgiapp = pylons.test.pylonsapp
-        else:
-            wsgiapp = loadapp('config:%s' % config['__file__'])
-        self.app = TestApp(wsgiapp)
-        url._push_object(URLGenerator(config['routes.map'], environ))
-

commentonit/tests/functional/__init__.py

Empty file removed.

commentonit/tests/functional/test_annotation.py

-from commentonit.tests import *
-
-class TestAnnotationController(TestController):
-
-    def test_index(self):
-        response = self.app.get(url(controller='annotation', action='index'))
-        # Test response...

commentonit/tests/functional/test_home.py

-from commentonit.tests import *
-
-class TestHomeController(TestController):
-
-    def test_index(self):
-        response = self.app.get(url('home'))
-        assert 'Comment on It' in response
-
-    def test_annotate(self):
-        res = self.app.get(url('annotate'))
-        assert 'Annotate' in res
-        assert 'annotator.min.css' in res
-    
-    sonnet = '''Shall I compare thee to a summer's day?
-Thou art more lovely and more temperate:
-Rough winds do shake the darling buds of May,
-And summer's lease hath all too short a date:
-Sometime too hot the eye of heaven shines,
-And often is his gold complexion dimm'd,
-And every fair from fair sometime declines,
-By chance, or nature's changing course untrimm'd: 
-But thy eternal summer shall not fade,
-Nor lose possession of that fair thou ow'st,
-Nor shall death brag thou wander'st in his shade,
-When in eternal lines to time thou grow'st,
-  So long as men can breathe, or eyes can see,
-  So long lives this, and this gives life to thee.
-'''
-
-    def test_app(self):
-        res = self.app.get(url('home'))
-        form = res.forms[0]
-        form['text'] = self.sonnet
-        res = form.submit()
-        assert 'Annotate' in res 
-        assert self.sonnet.split()[0] in res, res
-

commentonit/tests/test_model.py

-from commentonit.tests import *
-
-import commentonit.model as model
-
-class TestModel:
-    intext = u'''Hello world
-    '''
-
-    @classmethod
-    def teardown_class(self):
-        model.repo.rebuild_db()
-
-    def test_work(self):
-        title = u'Testing'
-        work = model.Work(title=title)
-        model.Session.add(work)
-        user = model.User(name=u'tester')
-        print work.owners
-        work.owners.append(user)
-        text = model.Text(work=work, payload_type=u'inline',
-                payload=self.intext)
-
-        model.Session.add(work)
-        model.Session.add(user)
-        model.Session.add(text)
-        model.Session.commit()
-        model.Session.remove()
-
-        w = model.Session.query(model.Work).filter_by(title=title).one()
-        assert w.title == title
-        assert w.texts[0].payload == self.intext
-        assert w.owners[0].name == u'tester'
-

commentonit/websetup.py

-"""Setup the commentonit application"""
-import logging
-
-from commentonit.config.environment import load_environment
-import commentonit.model as model
-
-log = logging.getLogger(__name__)
-
-def setup_app(command, conf, vars):
-    """Place any commands to setup commentonit here"""
-    load_environment(conf.global_conf, conf.local_conf)
-
-    model.repo.create_db()
-

pip-requirements.txt

--e hg+https://knowledgeforge.net/okfn/annotator#egg=annotator
--e hg+https://knowledgeforge.net/okfn/commentonit#egg=commentonit

setup.cfg

-[easy_install]
-find_links = http://www.pylonshq.com/download/
-
-[nosetests]
-with-pylons = test.ini
-
-# Babel configuration
-[compile_catalog]
-domain = commentonit
-directory = commentonit/i18n
-statistics = true
-
-[extract_messages]
-add_comments = TRANSLATORS:
-output_file = commentonit/i18n/commentonit.pot
-width = 80
-
-[init_catalog]
-domain = commentonit
-input_file = commentonit/i18n/commentonit.pot
-output_dir = commentonit/i18n
-
-[update_catalog]
-domain = commentonit
-input_file = commentonit/i18n/commentonit.pot
-output_dir = commentonit/i18n
-previous = true

setup.py

-from setuptools import setup, find_packages
-
-setup(
-    name='commentonit',
-    version='0.1',
-    description='',
-    author='',
-    author_email='',
-    url='',
-    install_requires=[
-        "Pylons>=0.9.7",
-        "SQLAlchemy>=0.5",
-        "Genshi>=0.4",
-        "annotator>=0.3a"
-    ],
-    setup_requires=["PasteScript>=1.6.3"],
-    packages=find_packages(exclude=['ez_setup']),
-    include_package_data=True,
-    test_suite='nose.collector',
-    package_data={'commentonit': ['i18n/*/LC_MESSAGES/*.mo']},
-    #message_extractors={'commentonit': [
-    #        ('**.py', 'python', None),
-    #        ('public/**', 'ignore', None)]},
-    zip_safe=False,
-    paster_plugins=['PasteScript', 'Pylons'],
-    entry_points="""
-    [paste.app_factory]
-    main = commentonit.config.middleware:make_app
-
-    [paste.app_install]
-    main = pylons.util:PylonsInstaller
-
-    [paste.paster_command]
-    db = commentonit.lib.cli:ManageDb
-    """,
-)

test.ini

-#
-# commentonit - Pylons testing environment configuration
-#
-# The %(here)s variable will be replaced with the parent directory of this file
-#
-[DEFAULT]
-debug = true
-# Uncomment and replace with the address which should receive any error reports
-#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 = config:development.ini
-
-# Add additional test specific configuration options as necessary.
-
-# SQLAlchemy database URL
-sqlalchemy.url = sqlite:///%(here)s/sqlite_test.db