Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

toolbar name dependent on order of get_or_create_menu() calls #2697

Closed
timgraham opened this Issue · 7 comments

3 participants

Tim Graham Iacopo Spalletti Patrick Lauber
Tim Graham

As documented, self.toolbar.get_or_create_menu('page') can result in the menu's verbose_name being None if that call is invoked before a call that includes the menu's name, like self.toolbar.get_or_create_menu('page', _('Page').

Tim Graham

(affects side and position arguments as well)

Patrick Lauber digi604 added this to the 3.0 milestone
Patrick Lauber digi604 added Easy Picking blocker and removed blocker labels
Iacopo Spalletti
Collaborator

Could you check in latest develop?
#2751 should have fixed it

Tim Graham

I can't reproduce (although I'm not sure the failure was deterministic in the first place), but we can close this for now, thanks.

Tim Graham timgraham closed this
Tim Graham

It happened again on latest develop. You can see in this code that if the menu key is already in self.menus, it'll be returned as-is, ignoring the arguments of subsequent calls. So if self.toolbar.get_or_create_menu('page') runs before a call that includes the name: self.toolbar.get_or_create_menu('page', _('Page') the menu will be named None.

Tim Graham timgraham reopened this
Patrick Lauber
Collaborator

according to

https://github.com/divio/django-cms/blob/develop/cms/toolbar/items.py#L236

is verbose name required. So self.toolbar.get_or_create_menu('page') should fail anyway.... no?

Tim Graham

Sorry, I've linked to the wrong instance of get_or_create_menu(). I've corrected it in the comment above.

Patrick Lauber
Collaborator

Ok an easy fix would be that if the verbose_name is something we set it again on the returned menu

Patrick Lauber digi604 added the blocker label
Patrick Lauber digi604 referenced this issue from a commit in digi604/django-cms
Patrick Lauber digi604 fixes #2697 443c5ef
Patrick Lauber digi604 closed this in #2884
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.