Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207551
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:24:45+00:00 2026-06-18T00:24:45+00:00

I am working on a breadcrumbs generator. It uses request.path and then, for each

  • 0

I am working on a breadcrumbs generator.
It uses request.path and then, for each subpath, builds a breadcrumb.

Example:

/blog/articles/view/12345

Then for each of the subpaths:

/blog/articles/view
/blog/articles
/blog

True would be returned, if there’s a view callable behind this URL ( allowing GET method without arguments ), otherwise False

So that I could make the subpaths in the breadcrumbs clickable to show that there’s something served there.

Any idea which would not call any of the subpaths and generate useless code execution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:24:46+00:00Added an answer on June 18, 2026 at 12:24 am

    No, you have to test all path prefixes; routing allows for many, arbitrary URLs to be possible. Moreover, with path predicates in the mix, multiple routes could match the same URL and choosing between them depends on other information from the request.

    To prepare your breadcrumbs, instead loop over the sub-paths once and determine for each if there is a matching view; the easiest way to do this is to reuse the code underlying the pviews command; this code needs the current request:

    from pyramid.scripts.pviews import PViewsCommand
    
    pvcomm = PViewsCommand()
    
    urlpath = request.environ['PATH_INFO']
    parts = urlpath.split('/')
    existing_views = {}
    
    for i in range(1, len(parts)):
        path = '/'.join(parts[:i])
        view = pvcomm._find_view(path, request.registry)
        if view is not None:
            existing_views[path] = view
    

    You can now look up path prefixes in the existing_views dictionary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys, i'm working on a very simple breadcrumb-path solution, however i have one
I'm working on this page: http://mockingbirdagency.com/thebox/profilestack.html Trying to put some breadcrumbs together but they
I am working on an iOS application and want to include the Breadcrumb iOS
I'm working on a site where we need dynamic breadcrumb generation. Pages within this
I am creating a breadcrumb partial view which takes in a collection of title/URL.
I have built a small breadcrumbs example cloning some functionality from Google's design. I
I am working on an existing website that uses Zend Framework, and I am
Working with an API that can handle multiple connections (i.e. sessions), each of these
So I'm trying to add a breadcrumb to a Drupal view, but it isn't
Working on a small game using an HTML5 canvas, and javascript. And it's working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.