Changeset 2

Show
Ignore:
Timestamp:
12/27/07 14:44:38 (11 months ago)
Author:
rgrp
Message:

[l] upgrade to pylons 0.9.6.1, overwriting all existing material and updating setup.py and README.txt to be reasonably accurate (license, description etc).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/development.ini

    r1 r2  
    66[DEFAULT] 
    77debug = true 
    8 email_to = you@yourdomain.com 
     8# Uncomment and replace with the address which should receive any error reports 
     9#email_to = you@yourdomain.com 
    910smtp_server = localhost 
    1011error_email_from = paste@localhost 
     
    1718[app:main] 
    1819use = egg:microfacts 
     20full_stack = true 
    1921cache_dir = %(here)s/data 
    20 session_key = microfacts 
    21 session_secret = somesecret 
     22beaker.session.key = microfacts 
     23beaker.session.secret = somesecret 
    2224 
    2325# If you'd like to fine-tune the individual locations of the cache data dirs 
    24 # for Myghty, the Cache data, or the Session saves, un-comment the desired 
    25 # settings here: 
    26 #myghty_data_dir = %(here)s/data/templates 
    27 #cache_data_dir = %(here)s/data/cache 
    28 #session_data_dir = %(here)s/data/sessions 
    29  
    30 # sqlalchemy db 
    31 sqlalchemy.dburi = sqlite:///%(here)s/microfacts_development.db 
     26# for the Cache data, or the Session saves, un-comment the desired settings 
     27# here: 
     28#beaker.cache.data_dir = %(here)s/data/cache 
     29#beaker.session.data_dir = %(here)s/data/sessions 
    3230 
    3331# WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* 
     
    3533# execute malicious code after an exception is raised. 
    3634#set debug = false 
     35 
     36 
     37# Logging configuration 
     38[loggers] 
     39keys = root, microfacts 
     40 
     41[handlers] 
     42keys = console 
     43 
     44[formatters] 
     45keys = generic 
     46 
     47[logger_root] 
     48level = INFO 
     49handlers = console 
     50 
     51[logger_microfacts] 
     52level = DEBUG 
     53handlers = 
     54qualname = microfacts 
     55 
     56[handler_console] 
     57class = StreamHandler 
     58args = (sys.stderr,) 
     59level = NOTSET 
     60formatter = generic 
     61 
     62[formatter_generic] 
     63format = %(asctime)s,%(msecs)03d %(levelname)-5.5s [%(name)s] %(message)s 
     64datefmt = %H:%M:%S 
  • trunk/microfacts/__init__.py

    r1 r2  
    1 """ 
    2 microfacts 
    3  
    4 This file loads the finished app from microfacts.config.middleware. 
    5  
    6 """ 
    7  
    8 from microfacts.config.middleware import make_app 
  • trunk/microfacts/config/__init__.py

    r1 r2  
    1 # 
  • trunk/microfacts/config/environment.py

    r1 r2  
     1"""Pylons environment configuration""" 
    12import os 
    23 
    3 import pylons.config 
    4 import webhelpers 
     4from pylons import config 
    55 
     6import microfacts.lib.app_globals as app_globals 
     7import microfacts.lib.helpers 
    68from microfacts.config.routing import make_map 
    79 
    8 def load_environment(global_conf={}, app_conf={}): 
    9     map = make_map(global_conf, app_conf) 
    10     # Setup our paths 
    11     root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
    12     paths = {'root_path': root_path, 
    13              'controllers': os.path.join(root_path, 'controllers'), 
    14              'templates': [os.path.join(root_path, path) for path in \ 
    15                            ('components', 'templates')], 
    16              'static_files': os.path.join(root_path, 'public') 
    17              } 
    18      
    19     # The following template options are passed to your template engines 
    20     tmpl_options = {} 
    21     tmpl_options['myghty.log_errors'] = True 
    22     tmpl_options['myghty.escapes'] = dict(l=webhelpers.auto_link, s=webhelpers.simple_format) 
    23      
    24     # Add your own template options config options here, note that all config options will override 
    25     # any Pylons config options 
    26      
    27     # Return our loaded config object 
    28     return pylons.config.Config(tmpl_options, map, paths) 
     10def load_environment(global_conf, app_conf): 
     11    """Configure the Pylons environment via the ``pylons.config`` 
     12    object 
     13    """ 
     14    # Pylons paths 
     15    root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
     16    paths = dict(root=root, 
     17                 controllers=os.path.join(root, 'controllers'), 
     18                 static_files=os.path.join(root, 'public'), 
     19                 templates=[os.path.join(root, 'templates')]) 
     20 
     21    # Initialize config with the basic options 
     22    config.init_app(global_conf, app_conf, package='microfacts', 
     23                    template_engine='genshi', paths=paths) 
     24 
     25    config['routes.map'] = make_map() 
     26    config['pylons.g'] = app_globals.Globals() 
     27    config['pylons.h'] = microfacts.lib.helpers 
     28 
     29    # Customize templating options via this variable 
     30    tmpl_options = config['buffet.template_options'] 
     31 
     32    # CONFIGURATION OPTIONS HERE (note: all config options will override 
     33    # any Pylons config options) 
  • trunk/microfacts/config/middleware.py

    r1 r2  
    1 from paste import httpexceptions 
     1"""Pylons middleware initialization""" 
    22from paste.cascade import Cascade 
     3from paste.registry import RegistryManager 
    34from paste.urlparser import StaticURLParser 
    4 from paste.registry import RegistryManager 
    5 from paste.deploy.config import ConfigMiddleware, CONFIG 
    65from paste.deploy.converters import asbool 
    76 
     7from pylons import config 
    88from pylons.error import error_template 
    9 from pylons.middleware import ErrorHandler, ErrorDocuments, StaticJavascripts, error_mapper 
    10 import pylons.wsgiapp 
     9from pylons.middleware import error_mapper, ErrorDocuments, ErrorHandler, \ 
     10    StaticJavascripts 
     11from pylons.wsgiapp import PylonsApp 
    1112 
    1213from microfacts.config.environment import load_environment 
    13 import microfacts.lib.helpers 
    14 import microfacts.lib.app_globals as app_globals 
    1514 
    1615def make_app(global_conf, full_stack=True, **app_conf): 
    17     """Create a WSGI application and return it 
    18      
    19     global_conf is a dict representing the Paste configuration options, the 
    20     paste.deploy.converters should be used when parsing Paste config options 
    21     to ensure they're treated properly. 
    22      
     16    """Create a Pylons WSGI application and return it 
     17 
     18    ``global_conf`` 
     19        The inherited configuration for this application. Normally from 
     20        the [DEFAULT] section of the Paste ini file. 
     21 
     22    ``full_stack`` 
     23        Whether or not this application provides a full WSGI stack (by 
     24        default, meaning it handles its own exceptions and errors). 
     25        Disable full_stack when this application is "managed" by 
     26        another WSGI middleware. 
     27 
     28    ``app_conf`` 
     29        The application's local configuration. Normally specified in the 
     30        [app:<name>] section of the Paste ini file (where <name> 
     31        defaults to main). 
    2332    """ 
    24     # Setup the Paste CONFIG object 
    25     CONFIG.push_process_config({'app_conf': app_conf, 
    26                                 'global_conf': global_conf}) 
     33    # Configure the Pylons environment 
     34    load_environment(global_conf, app_conf) 
    2735 
    28     # Load our Pylons configuration defaults 
    29     config = load_environment(global_conf, app_conf) 
    30     config.init_app(global_conf, app_conf, package='microfacts') 
    31          
    32     # Load our default Pylons WSGI app and make g available 
    33     app = pylons.wsgiapp.PylonsApp(config, helpers=microfacts.lib.helpers, 
    34                                    g=app_globals.Globals) 
    35     g = app.globals 
    36     app = ConfigMiddleware(app, {'app_conf':app_conf, 
    37         'global_conf':global_conf}) 
    38      
    39     # YOUR MIDDLEWARE 
    40     # Put your own middleware here, so that any problems are caught by the error 
    41     # handling middleware underneath 
    42      
    43     # If errror handling and exception catching will be handled by middleware 
    44     # for multiple apps, you will want to set full_stack = False in your config 
    45     # file so that it can catch the problems. 
     36    # The Pylons WSGI app 
     37    app = PylonsApp() 
     38 
     39    # CUSTOM MIDDLEWARE HERE (filtered by error handling middlewares) 
     40 
    4641    if asbool(full_stack): 
    47         # Change HTTPExceptions to HTTP responses 
    48         app = httpexceptions.make_middleware(app, global_conf) 
    49      
    50         # Error Handling 
    51         app = ErrorHandler(app, global_conf, error_template=error_template, **config.errorware) 
    52      
    53         # Display error documents for 401, 403, 404 status codes (if debug is disabled also 
    54         # intercepts 500) 
     42        # Handle Python exceptions 
     43        app = ErrorHandler(app, global_conf, error_template=error_template, 
     44                           **config['pylons.errorware']) 
     45 
     46        # Display error documents for 401, 403, 404 status codes (and 
     47        # 500 when debug is disabled) 
    5548        app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf) 
    56      
     49 
    5750    # Establish the Registry for this application 
    5851    app = RegistryManager(app) 
    59      
    60     static_app = StaticURLParser(config.paths['static_files']) 
     52 
     53    # Static files 
    6154    javascripts_app = StaticJavascripts() 
     55    static_app = StaticURLParser(config['pylons.paths']['static_files']) 
    6256    app = Cascade([static_app, javascripts_app, app]) 
    6357    return app 
  • trunk/microfacts/config/routing.py

    r1 r2  
     1"""Routes configuration 
     2 
     3The more specific and detailed routes should be defined first so they 
     4may take precedent over the more generic routes. For more information 
     5refer to the routes manual at http://routes.groovie.org/docs/ 
    16""" 
    2 Setup your Routes options here 
    3 """ 
    4 import os 
     7from pylons import config 
    58from routes import Mapper 
    69 
    7 def make_map(global_conf={}, app_conf={}): 
    8     root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 
     10def make_map(): 
     11    """Create, configure and return the routes Mapper""" 
     12    map = Mapper(directory=config['pylons.paths']['controllers'], 
     13                 always_scan=config['debug']) 
    914 
    10     map = Mapper(directory=os.path.join(root_path, 'controllers')) 
    11      
    12     # This route handles displaying the error page and graphics used in the 404/500 
    13     # error pages. It should likely stay at the top to ensure that the error page is 
    14     # displayed properly. 
     15    # The ErrorController route (handles 404/500 error pages); it should 
     16    # likely stay at the top, ensuring it can always be resolved 
    1517    map.connect('error/:action/:id', controller='error') 
    16      
    17     # Define your routes. The more specific and detailed routes should be defined first, 
    18     # so they may take precedent over the more generic routes. For more information, refer 
    19     # to the routes manual @ http://routes.groovie.org/docs/ 
     18 
     19    # CUSTOM ROUTES HERE 
     20 
    2021    map.connect(':controller/:action/:id') 
    2122    map.connect('*url', controller='template', action='view') 
  • trunk/microfacts/controllers/error.py

    r1 r2  
    11import os.path 
    2 from paste import fileapp 
    3 from pylons.middleware import media_path, error_document_template 
    4 from pylons.util import get_prefix 
     2 
     3import paste.fileapp 
     4from pylons.middleware import error_document_template, media_path 
     5 
    56from microfacts.lib.base import * 
    67 
    78class ErrorController(BaseController): 
    8     """ 
    9     Class to generate error documents as and when they are required. This behaviour of this 
    10     class can be altered by changing the parameters to the ErrorDocuments middleware in  
    11     your config/middleware.py file. 
     9    """Generates error documents as and when they are required. 
     10 
     11    The ErrorDocuments middleware forwards to ErrorController when error 
     12    related status codes are returned from the application. 
     13 
     14    This behaviour can be altered by changing the parameters to the 
     15    ErrorDocuments middleware in your config/middleware.py file. 
    1216    """ 
    1317 
    1418    def document(self): 
    15         """ 
    16         Change this method to change how error documents are displayed 
    17         """ 
    18         page = error_document_template % { 
    19             'prefix': get_prefix(request.environ), 
    20             'code': request.params.get('code', ''), 
    21             'message': request.params.get('message', ''), 
    22         } 
    23         return Response(page) 
     19        """Render the error document""" 
     20        page = error_document_template % \ 
     21            dict(prefix=request.environ.get('SCRIPT_NAME', ''), 
     22                 code=request.params.get('code', ''), 
     23                 message=request.params.get('message', '')) 
     24        return page 
    2425 
    2526    def img(self, id): 
     27        """Serve Pylons' stock images""" 
    2628        return self._serve_file(os.path.join(media_path, 'img', id)) 
    27          
     29 
    2830    def style(self, id): 
     31        """Serve Pylons' stock stylesheets""" 
    2932        return self._serve_file(os.path.join(media_path, 'style', id)) 
    3033 
    3134    def _serve_file(self, path): 
    32         fapp = fileapp.FileApp(path) 
     35        """Call Paste's FileApp (a WSGI application) to serve the file 
     36        at the specified path 
     37        """ 
     38        fapp = paste.fileapp.FileApp(path) 
    3339        return fapp(request.environ, self.start_response) 
  • trunk/microfacts/controllers/template.py

    r1 r2  
    22 
    33class TemplateController(BaseController): 
     4 
    45    def view(self, url): 
    5         """ 
    6         This is the last place which is tried during a request to try to find a  
    7         file to serve. It could be used for example to display a template:: 
    8          
     6        """By default, the final controller tried to fulfill the request 
     7        when no other routes match. It may be used to display a template 
     8        when all else fails, e.g.:: 
     9 
    910            def view(self, url): 
    10                 return render_response(url) 
    11          
    12         Or, if you're using Myghty and would like to catch the component not 
    13         found error which will occur when the template doesn't exist; you 
    14         can use the following version which will provide a 404 if the template 
    15         doesn't exist:: 
    16          
    17             import myghty.exception 
    18              
     11                return render('/%s' % url) 
     12 
     13        Or if you're using Mako and want to explicitly send a 404 (Not 
     14        Found) response code when the requested template doesn't exist:: 
     15 
     16            import mako.exceptions 
     17 
    1918            def view(self, url): 
    2019                try: 
    21                     return render_response('/'+url) 
    22                 except myghty.exception.ComponentNotFound
    23                     return Response(code=404) 
    24          
    25         The default is just to abort the request with a 404 File not found 
    26         status message. 
     20                    return render('/%s' % url) 
     21                except mako.exceptions.TopLevelLookupException
     22                    abort(404) 
     23 
     24        By default this controller aborts the request with a 404 (Not 
     25        Found) 
    2726        """ 
    2827        abort(404) 
  • trunk/microfacts/lib/app_globals.py

    r1 r2  
     1"""The application's Globals object""" 
     2from pylons import config 
     3 
    14class Globals(object): 
     5    """Globals acts as a container for objects available throughout the 
     6    life of the application 
     7    """ 
    28 
    3     def __init__(self, global_conf, app_conf, **extra): 
    4         """ 
    5         Globals acts as a container for objects available throughout 
    6         the life of the application. 
    7  
    8         One instance of Globals is created by Pylons during 
    9         application initialization and is available during requests 
    10         via the 'g' variable. 
    11          
    12         ``global_conf`` 
    13             The same variable used throughout ``config/middleware.py`` 
    14             namely, the variables from the ``[DEFAULT]`` section of the 
    15             configuration file. 
    16              
    17         ``app_conf`` 
    18             The same ``kw`` dictionary used throughout 
    19             ``config/middleware.py`` namely, the variables from the 
    20             section in the config file for your application. 
    21              
    22         ``extra`` 
    23             The configuration returned from ``load_config`` in  
    24             ``config/middleware.py`` which may be of use in the setup of 
    25             your global variables. 
    26              
    27         """ 
    28         import microfacts.models as model 
    29         model.connect() 
    30  
    31     def __del__(self): 
    32         """ 
    33         Put any cleanup code to be run when the application finally exits  
    34         here. 
     9    def __init__(self): 
     10        """One instance of Globals is created during application 
     11        initialization and is available during requests via the 'g' 
     12        variable 
    3513        """ 
    3614        pass 
  • trunk/microfacts/lib/base.py

    r1 r2  
    1 from pylons import Response, c, g, cache, request, session 
     1"""The base Controller API 
     2 
     3Provides the BaseController class for subclassing, and other objects 
     4utilized by Controllers. 
     5""" 
     6from pylons import c, cache, config, g, request, response, session 
    27from pylons.controllers import WSGIController 
     8from pylons.controllers.util import abort, etag_cache, redirect_to 
    39from pylons.decorators import jsonify, validate 
    4 from pylons.templating import render, render_response 
    5 from pylons.helpers import abort, redirect_to, etag_cache 
    6 from pylons.i18n import N_, _, ungettext 
    7 import microfacts.models as model 
     10from pylons.i18n import _, ungettext, N_ 
     11from pylons.templating import render 
     12 
    813import microfacts.lib.helpers as h 
     14import microfacts.model as model 
    915 
    1016class BaseController(WSGIController): 
     17 
    1118    def __call__(self, environ, start_response): 
    12         # Refresh database session 
    13         model.resync() 
    14         # Insert any code to be run per request here. The Routes match 
    15         # is under environ['pylons.routes_dict'] should you want to check 
    16         # the action or route vars here 
     19        """Invoke the Controller""" 
     20        # WSGIController.__call__ dispatches to the Controller method 
     21        # the request is routed to. This routing information is 
     22        # available in environ['pylons.routes_dict'] 
    1723        return WSGIController.__call__(self, environ, start_response) 
    1824 
  • trunk/microfacts/lib/helpers.py

    r1 r2  
    1 """ 
    2 Helper functions 
     1"""Helper functions 
    32 
    4 All names available in this module will be available under the Pylons h object. 
     3Consists of functions to typically be used within templates, but also 
     4available to Controllers. This module is available to both as 'h'. 
    55""" 
    66from webhelpers import * 
    7 from pylons.helpers import log 
    8 from pylons.i18n import get_lang, set_lang 
  • trunk/microfacts/public/index.html

    r1 r2  
    3030<h2>Weren't expecting to see this page?</h2> 
    3131 
    32 <p>The microfacts/public/ directory is searched for static files 
    33  <i>before</i> your controllers are run. Remove this file (microfacts/public/index.html) and edit 
    34   the routes in <tt>microfacts/config/routing.py</tt> like so: 
     32<p>The <tt>microfacts/public/</tt> directory is searched for static files 
     33 <i>before</i> your controllers are run. Remove this file (<tt>microfacts/public/index.html</tt>) 
     34  and edit the routes in <tt>microfacts/config/routing.py</tt> to point the 
     35  <a href="/">root path</a> to a 'hello' controller we'll create below: 
    3536  <pre> map.connect('', controller='hello', action='index')</pre> 
    3637</p> 
    3738 
    3839<h2>Getting Started</h2> 
    39 <p>You're now ready to start creating your own web application. Here's what a basic controller looks 
    40 like to print out 'Hello World' and respond to http://127.0.0.1:5000/hello: 
     40<p>You're now ready to start creating your own web application. To create a 'hello' controller, 
     41  run the following command in your project's root directory:  
    4142<pre> 
    42 # microfacts/controllers/hello.py 
    43 # Note that the line above is the file you should create and put the following into... 
     43microfacts$ paster controller hello 
     44</pre> 
     45 
     46  This generates the following the following code in <tt>microfacts/controllers/hello.py</tt>: 
     47<pre> 
     48import logging 
    4449 
    4550from microfacts.lib.base import * 
    4651 
     52log = logging.getLogger(__name__) 
     53 
    4754class HelloController(BaseController): 
     55 
    4856    def index(self): 
    49         return Response('Hello World') 
    50          
     57        # Return a rendered template 
     58        #   return render('/some/template.mako) 
     59        # or, Return a response 
     60        return 'Hello World' 
    5161</pre> 
     62</p> 
     63<p>This controller simply prints out 'Hello World' to the browser. Pylons' default routes 
     64  automatically set up this controller to respond at the <a href="/hello">/hello</a> URL. 
     65  With the additional route described above, this controller will also respond at the 
     66  <a href="/">root path</a>. 
    5267</p> 
    5368 
    5469<h3>Using a template</h3> 
    55 <p>If you want to call a template and do something a little more complex, here's an example printing out some 
    56 request information from a Myghty template. 
     70<p>To call a template and do something a little more complex, this following example 
     71   shows how to print out some request information from a 
     72  <a href="http://www.makotemplates.org">Mako</a> template. 
     73</p> 
     74<p>Create a <tt>serverinfo.mako</tt> file in your project's <tt>microfacts/templates/</tt> 
     75  directory with the following contents: 
     76</p>   
    5777<pre> 
    58 # microfacts/templates/serverinfo.myt 
     78&lt;h2&gt; 
     79Server info for ${request.host} 
     80&lt;/h2&gt; 
    5981 
    60 &lt;p>Hi, here's the server environment: &lt;br /> 
    61 &lt;% str(request.environ) %>&lt;/p> 
     82&lt;p&gt; 
     83The URL you called: ${h.url_for()} 
     84&lt;/p&gt; 
    6285 
    63 &lt;p> 
    64 here's the URL you called: &lt;% h.url_for() %> 
    65 &lt;/p> 
     86&lt;p&gt; 
     87The name you set: ${c.name} 
     88&lt;/p&gt; 
    6689 
    67 &lt;p> 
    68 and here's the name you set: &lt;% c.name %> 
    69 &lt;/p> 
    70  
     90&lt;p&gt;The WSGI environ:&lt;br /&gt; 
     91&lt;pre&gt;${c.pretty_environ}&lt;/pre&gt; 
     92&lt;/p&gt; 
    7193</pre> 
    7294 
    73 Then add this to your hello controller class: 
     95Then add the following to your 'hello' controller class: 
    7496<pre> 
    7597    def serverinfo(self): 
     98        import cgi 
     99        import pprint 
     100        c.pretty_environ = cgi.escape(pprint.pformat(request.environ)) 
    76101        c.name = 'The Black Knight' 
    77         return render_response('/serverinfo.myt') 
     102        return render('/serverinfo.mako') 
    78103</pre> 
    79104 
    80 You can now view the page at: <tt>http://127.0.0.1:5000/hello/serverinfo</tt> 
     105You can now view the page at: <tt><a href="/hello/serverinfo">/hello/serverinfo</a></tt> 
    81106</p> 
    82107</body> 
  • trunk/microfacts/tests/__init__.py

    r1 r2  
     1"""Pylons application test package 
     2 
     3When the test runner finds and executes tests within this directory, 
     4this file will be loaded to setup the test environment. 
     5 
     6It registers the root directory of the project in sys.path and 
     7pkg_resources, in case the project hasn't been installed with 
     8setuptools. It also initializes the application via websetup (paster 
     9setup-app) with the project's test.ini configuration file. 
     10""" 
    111import os 
    212import sys 
    313from unittest import TestCase 
     14 
     15import pkg_resources 
     16import paste.fixture 
     17import paste.script.appinstall 
     18from paste.deploy import loadapp 
     19from routes import url_for 
     20 
     21__all__ = ['url_for', 'TestController'] 
    422 
    523here_dir = os.path.dirname(os.path.abspath(__file__)) 
     
    725 
    826sys.path.insert(0, conf_dir) 
    9  
    10 import pkg_resources 
    11  
    1227pkg_resources.working_set.add_entry(conf_dir) 
    13  
    1428pkg_resources.require('Paste') 
    1529pkg_resources.require('PasteScript') 
    16  
    17 from paste.deploy import loadapp 
    18 import paste.fixture 
    19 import paste.script.appinstall 
    20  
    21 from microfacts.config.routing import * 
    22 from routes import request_config, url_for 
    2330 
    2431test_file = os.path.join(conf_dir, 'test.ini') 
     
    2633cmd.run([test_file]) 
    2734 
    28 wsgiapp = loadapp('config:test.ini', relative_to=conf_dir) 
    29 from microfacts import models as model 
    30 model.connect() 
     35class TestController(TestCase): 
    3136 
    32 class TestModel(TestCase): 
    33     def setUp(self): 
    34         model.resync() 
    35         model.metadata.create_all() 
    36     def tearDown(self): 
    37         model.metadata.drop_all() 
    38  
    39 class TestController(TestModel): 
    40     def __init__(self, *args): 
     37    def __init__(self, *args, **kwargs): 
     38        wsgiapp = loadapp('config:test.ini', relative_to=conf_dir) 
    4139        self.app = paste.fixture.TestApp(wsgiapp) 
    42         TestModel.__init__(self, *args) 
    43      
    44 __all__ = ['url_for', 'TestController', 'TestModel', 'model'] 
     40        TestCase.__init__(self, *args, **kwargs) 
  • trunk/microfacts/websetup.py

    r1 r2  
    1 from paste.deploy import loadapp 
     1"""Setup the microfacts application""" 
     2import logging 
     3 
     4from paste.deploy import appconfig 
     5from pylons import config 
     6 
     7from microfacts.config.environment import load_environment 
     8 
     9log = logging.getLogger(__name__) 
    210 
    311def setup_config(command, filename, section, vars): 
    4     """ 
    5     Place any commands to setup sandbox here. 
    6     """     
    7     app = loadapp('config:' + filename) 
    8     from microfacts import models as model 
    9     model.connect() 
     12    """Place any commands to setup microfacts here""" 
     13    conf = appconfig('config:' + filename) 
     14    load_environment(conf.global_conf, conf.local_conf) 
  • trunk/setup.py

    r1 r2  
    1 from setuptools import setup, find_packages 
     1try: 
     2    from setuptools import setup, find_packages 
     3except ImportError: 
     4    from ez_setup import use_setuptools 
     5    use_setuptools() 
     6    from setuptools import setup, find_packages 
    27 
    38setup( 
    49    name='microfacts', 
    5     version="", 
    6     #description="", 
    7     #author="", 
    8     #author_email="", 
    9     #url="", 
    10     install_requires=["Pylons>=0.9.4"], 
    11     packages=find_packages(), 
     10    version='0.1', 
     11    license='MIT', 
     12    description=\ 
     13"A web application for threading together 'factlets' into narratives organized by theme, time and space.", 
     14    author='Open Knowledge Foundation', 
     15    author_email='info@okfn.org', 
     16    url='http://www.okfn.org/microfacts/', 
     17    install_requires=["Pylons>=0.9.6.1"], 
     18    packages=find_packages(exclude=['ez_setup']), 
    1219    include_package_data=True, 
    13     test_suite = 'nose.collector', 
     20    test_suite='nose.collector', 
    1421    package_data={'microfacts': ['i18n/*/LC_MESSAGES/*.mo']}, 
     22    #message_extractors = {'microfacts': [ 
     23    #        ('**.py', 'python', None), 
     24    #        ('public/**', 'ignore', None)]}, 
    1525    entry_points=""" 
    1626    [paste.app_factory] 
    17     main=microfacts:make_app 
     27    main = microfacts.config.middleware:make_app 
     28 
    1829    [paste.app_install] 
    19     main=paste.script.appinstall:Installer 
     30    main = pylons.util:PylonsInstaller 
    2031    """, 
    2132) 
  • trunk/test.ini

    r1 r2  
    66[DEFAULT] 
    77debug = true 
    8 email_to = you@yourdomain.com 
     8# Uncomment and replace with the address which should receive any error reports 
     9#email_to = you@yourdomain.com 
    910smtp_server = localhost 
    1011error_email_from = paste@localhost 
     
    1920 
    2021# Add additional test specific configuration options as necessary. 
    21  
    22 sqlalchemy.dburi = sqlite:///:memory: