Topic: https://russell.ballestrini.net/add-a-breadcrumb-subscriber-to-a-pyramid-project-using-4-simple-steps/
hide preview

What's next? verify your email address for reply notifications!

Mark-Huang-rb 11y, 299d ago

Wow, that was dead simple man! Thanks for the little tutorial!

I was thinking of integrating your solution with Twitter Bootstrap's Bread crumb ui.

remark link
hide preview

What's next? verify your email address for reply notifications!

russell 11y, 299d ago [edited]

Hey Mark, thank you for your kind comments. Feel free to show off the twitter bootstrap integration!

hide preview

What's next? verify your email address for reply notifications!

Julien-Tanay-rb 11y, 146d ago [edited]

Hi ! Your breadcrumbs solution is the best I've found so far. After implementing it in my Pyramid application, it happens that link are displayed without being interpreted in HTML:

"localhost:6543 / (...)"

Did I miss something ?

Thanks,

Julien

hide preview

What's next? verify your email address for reply notifications!

Julien-Tanay-rb 11y, 146d ago [edited]

@update :

I solved my error by tweaking a bit your links function :

def links( self ):
    links = []
    for count, crumb in enumerate( self.crumbs, start = 1 ):
        crumb_uri = self._protocol + '/'.join( self.crumbs[ 0:count ] )
        links.append({'uri':crumb_uri, 'crumb':crumb})
    return links

I also embedded it in a Bootstrap breadcrumb (as suggested earlier) :

% for link in request.bread.links:

      <a href="${link['uri']}" rel="nofollow">${link['crumb']}</a> /

  % endfor

Thanks again for this useful tool !

Julien

hide preview

What's next? verify your email address for reply notifications!

russell 11y, 146d ago [edited]

The problem wasn't with the links method, the problem was with my example mako template code:

% for link in links:
    ${link|n} /  
% endfor

Newer versions of pyramid escape HTML. To prevent escaping HTML (to send HTML into your template from your view) use the | n filter.

I updated the example above to be more correct.

hide preview

What's next? verify your email address for reply notifications!

Julien-Tanay-rb 11y, 146d ago

Hi Russell,

Thanks for your answer !

btw, you solved another problem I faced with this | n tip :).

Julien

hide preview

What's next? verify your email address for reply notifications!