On Fri, May 16, 2008 at 6:50 AM, mitchm <[EMAIL PROTECTED]> wrote: > > I've noticed that the current implementation of Routes requires you to > have Routes accessible (as a package, not sub-package) from your > PYTHONPATH or site-packages directory. If one wants to include it as a > sub-package of their development environment (aka framework) such as > framework_name_here.plugins.Routes, it won't work. > > In the application I recently deployed (with mod_python) the following > changes to Routes worked perfectly without issue. > > It may be worth while to make the changes to the core Routes lib so it > will be accessible no matter where its placed. > > 1. In "__init__.py" remove all code but the following: > > from base import Mapper > from util import url_for, redirect_to > from common import request_config > __all__=['Mapper', 'url_for', 'redirect_to', 'request_config'] > > 2. put the removed code in a new file called "common.py".
Routes 2, which is under development, essentially does this. Only the RouteMap object is exported, plus a few convenience regexes for requirements. url_for is replaced by a 'url' object which will probably be exported in the WSGI environ. redirect_to will probably be replaced by pylons.controllers.util.redirect(). request_config() is going away. But it's not a goal of Routes to be embeddable as a subpackage. If you want Routes, install the Routes package, as with all other Python packages. Routes 2 uses absolute imports per the current Python recommendations. You can of course change them to relative imports if you insist. -- Mike Orr <[EMAIL PROTECTED]> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---
