Re: [Repoze-dev] Predicates on routes vs views
2009/10/23 Chris McDonough : > I don't think there's anything in particular in the way. I'd like to have > some concrete use cases before we add the code, because it could be > difficult to document. We have this particular use-case (we might not have it anymore, but for the record): You want traversal for URLs which end in ".html". Any other URL will be handled differently. That's strictly a routing issue, so let's not try and phrase it in terms of view predicates, but instead "route predicates". At any rate, predicates on seems in my eyes to suggest that they determine whether the route is used, and not whether the view associated with the route is invoked (then you should define the predicate on a ). \malthe ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Predicates on routes vs views
Malthe Borch wrote: > 2009/10/22 Chris McDonough : >> Do we just need to change the path matching syntax instead to get your >> *.html case to work? Is there another case for predicates? > > I think that in general, predicates make sense without the view on > s. Is there anything in the way of letting them act upon > ``route.match`` instead of ``view.predicate_checker``? I don't think there's anything in particular in the way. I'd like to have some concrete use cases before we add the code, because it could be difficult to document. - C ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Predicates on routes vs views
2009/10/22 Chris McDonough : > Do we just need to change the path matching syntax instead to get your > *.html case to work? Is there another case for predicates? I think that in general, predicates make sense without the view on s. Is there anything in the way of letting them act upon ``route.match`` instead of ``view.predicate_checker``? \malthe ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Predicates on routes vs views
Malthe Borch wrote: > 2009/10/22 Tres Seaver : >> The view predicates are there to allow selecting a particular view among >> several registered for the route or context: e.g., to dispatch to >> different views for GET versus POST for the same route / context and >> view name. > > It makes perfect sense with . > > With , however, I think predicates make sense without > specifying a view. And currently, predicates are silently ignored if > you don't provide a view directly when you define a route. Do we just need to change the path matching syntax instead to get your *.html case to work? Is there another case for predicates? - C ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Predicates on routes vs views
2009/10/22 Tres Seaver : > The view predicates are there to allow selecting a particular view among > several registered for the route or context: e.g., to dispatch to > different views for GET versus POST for the same route / context and > view name. It makes perfect sense with . With , however, I think predicates make sense without specifying a view. And currently, predicates are silently ignored if you don't provide a view directly when you define a route. \malthe ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev
Re: [Repoze-dev] Predicates on routes vs views
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Malthe Borch wrote: > Currently the predicates pertain only to views, regardless of whether > they're declared using a or a directive (or using the > ``bfg_view`` decorator). > > I would expect that if you declare a predicate on the route, that the > route would only be used if that predicate matches. Instead, the route > is used regardless, while the view which is declared on that same > route is guarded with the predicate check. > > Does it make sense (and is it feasible in terms of > backwards-compatibility concerns) to have the predicate be matched > against the route, and if it does not match, go on to the next route? I'm not sure I understand: routes already behave as predicates, and chain exactly as you describe. The view predicates are there to allow selecting a particular view among several registered for the route or context: e.g., to dispatch to different views for GET versus POST for the same route / context and view name. Tres. - -- === Tres Seaver +1 540-429-0999 tsea...@palladion.com Palladion Software "Excellence by Design"http://palladion.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkrgiboACgkQ+gerLs4ltQ5rFwCfcXDoxPGb1GimRe9mgy9D5qEx tNMAn2wBU+460wN7Hrgm5S8sdlU5vqX3 =L9F+ -END PGP SIGNATURE- ___ Repoze-dev mailing list Repoze-dev@lists.repoze.org http://lists.repoze.org/listinfo/repoze-dev