-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/30/2016 01:38 AM, Mike Orr wrote:
> 1) Right now I'm doing the 'context["index.html"]' lookup in the view > because I don't know how to do it during traversal. The problem is > that when I'm in a traversal level that's a directory, there are two > possible outcomes. If I'm in the middle of the URL, I should allow it > to traverse normally to the next subdirectory or file. But if I'm at > the end of the URL (no child but maybe a view afterward), then I want > to implicitly append the "index.html" file as a child. One, can I do > that, and two, is it possible to tell in a traversal level whether > it's the last one or not (i.e.,whether there's a child in the URL)? If the default view (see below) for your directory class just does a redirect to 'index.html', and you register a view named 'index.html' for it, that should work: if there is an item named 'index.html', it's default view will be served; otherwise, the 'index.html' view. > 2) Is it possible for a resource to offer a default view? Kotti has > some feature where a resource (a database record) has a default view > field that can be customized by the site admin. I don't know how that > works. Is it feasable to do this without hacking up the view lookup > mechanism severely? A default view is just a view with the empty string for its name. You may be looking at it already, but the "Traveral Agorithm" docs explain this in detail: http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/traversal.htm l#the-traversal-algorithm BTW, your application sounds startlingly similar to 'repoze.virginia', and early proof-of-concept for the publishing logic which became 'repoze.bfg' and later Pyramid: http://svn.repoze.org/repoze.virginia/trunk/ Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 [email protected] Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJX7gY2AAoJEPKpaDSJE9HYZ2kP/1CYGn3QX4zdUV/DG9UwN/0i n9WSFKozo6Vwy2oxgy6Y21+lC06wkCk18QiN8ahEfzZe4loy07+wUMf8ythRrzMM b+SsMOZNUGdySaRErpCBhfrUKDbOmVqnwjg01aLFJE/B97/Ga88MS0DX/XB7qS1o hNs/a0r3MFl+uXLKHstAE5u13iuMCeF0SS8xs5xmgMp/xbC2Z0yUmsGxhGeMJ/d9 cjbSmBkQuhbKZooVgd36uY8YvSq5Yw1p807+2pza1gTXJcaTrdzt9qNrMdW7DCaE J7uNFJ3ucOYIlWGz2A+5Svdg8SXUOKS50kpRDsxB376Njc0e/CT+776yBQKT1UH0 wRFEXLAbeOmSjlKWSLz68JHbnJydH2HHqBNXBOLqUQ78SB+y1QaMH7bv9WYQKwmk S+Nb3AAzx1IeS4UJ3PQsHzP22Ox4w627304QdCzTTMrpXogopqYVZs4xCgyzsupN vpcZLmsi3rWNLPybdU/ipSz9J9UGVpt+rBwfByut5h91cRfijYA5LeRPjw6wpz15 BbG0SndidNrkWU10cQzr0Kpo3LF0HFSjXLkCvnRlljScJ0Tx1/V64mN/ZrVjLve2 GJ6A+dg4f6ddMYH75+KxC7Ww04OlJrVjRi+c2OWfJNIBXOovvyDOeAvjllSupn/7 WhZWqwFVFORlquscYrYM =IeR6 -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/nsl0nq%245hk%241%40blaine.gmane.org. For more options, visit https://groups.google.com/d/optout.
