Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Nejc Zupan
Just a bit of logistics help, should you need it: * an affordable and reliable way of getting to Ljubljana from Budapest is the van sharing service GoOpti.com. Been using them for years. * there is a discussion on the sprint’s mailinglist about sharing an AirBNB place: https://groups.google.com/

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Mikko Ohtamaa
On 11 November 2016 at 00:53, Zsolt Ero wrote: > Thanks a lot! I'm thinking about it, since I'm quite close (in Budapest). See you with the dragons, then! :) -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group an

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Zsolt Ero
Thanks a lot! I'm thinking about it, since I'm quite close (in Budapest). On Thu, 10 Nov 2016 at 23:48 Mikko Ohtamaa < mailto:Mikko Ohtamaa > wrote: a, pre, code, a:link, body { word-wrap: break-word !important; } This might or might not work, but looks complicated enough for me not to know i

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Mikko Ohtamaa
> This might or might not work, but looks complicated enough for me not to > know if there is a possible bug in it, that I'll just stick with > has_permission and duplicated values in templates. > > Fair. There is a Pyramid sprint coming in December: https://dragonsprint.com/ If you want to get th

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Mikko Ohtamaa
> And my views are defined like this: > @view_config(route_name='admin_db_list', renderer='admin/db_list.jinja2', > permission='superadmin') > def db_list(request): ... > > > So in this situation, my context is request.root (or request.context), is > this right? > > If I try view_execution_permitte

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Zsolt Ero
Thanks. So this is how my site is setup: I have a RootFactory: class RootFactory(object): __acl__ = [ (Allow, Authenticated, 'user'), (Allow, 'g:admin', 'admin'), (Allow, 'g:superadmin', 'ALL_PERMISSIONS'), ] def __init__(self, request): pass used in

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Mikko Ohtamaa
And to elaborate the following: I simply check for the permission I know the target has using request.has_permission(): https://websauna.org/docs/narrative/user/permissions. html?highlight=permissions#checking-permissions-in-templates - Define a Root object - In this root you have a dynamic __a

Re: [pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Mikko Ohtamaa
> > I'm looking for a function to fit in this usage: > > {% macro nav_item(request, route_name, text) -%} > {% if request.view_execution_permitted(route_name) %} > > {{ text }} > > {% endif %} > {%- endmacro %} > > > My problems are the following: > > 1. view_execution_permitted

[pylons-discuss] Checking if a route is allowed

2016-11-10 Thread Zsolt Ero
Hi, I'd like to do the simplest possible thing in Pyramid / URL Dispatch, yet it seems almost impossibly hard to do it. So it's the super common case of having a menu, and I'd only like to insert menu items which are available for the current user. I'm looking for a function to fit in this usag