On Fri, Jun 5, 2009 at 11:44 AM, Chris Rossi <ch...@archimedeanco.com>wrote:

> On Fri, Jun 5, 2009 at 11:33 AM, Chris McDonough <chr...@plope.com> wrote:
>> - If a "factory" is specified on a route, it will need to point at a
>>   function that had the same call/response convention as a traversal
>>   root factory.  This will break code.  "Context factories" accept
>>   key/value pairs assumed to be items that matched in the URL match.
>>   These would cease working, and would need to be rewritten as root
>>   factories, which accept a WSGI environment.
> My gut feeling is this should be a show-stopper.  Not having easy access to
> the match dict when doing routes just goes too far in terms of breaking
> expectations about how routes should work.
> That said, I think the goal of unifying the two methods is very compelling,
> so we should spend some more time thinking about how to accomplish this
> without breaking fundamental expectations with regards to url dispatch. The
> idea of performing a graph traversal starting at a context found by a routes
> match is particularly compelling and reason enough to pursue a unification.
> I'd just suggest thinking about it a little more before starting to move
> code around.  I'll try and devote some brain cycles of my own to the
> problem.

I guess the most stupidly straightforward solution might be something like:

class UnifiedFactory(Interface):
    def __call__(self, environ, **routes_match):
        Replaces concepts of root factory used for traversal and context
        factory used for routes, into a single concept.  environ is the
        WSGI environment, and the match dict from routes matching, if
        applicable, is passed in as kw args.

Repoze-dev mailing list

Reply via email to