Check variable before accessing attribute
This commit is contained in:
parent
c5026ad0eb
commit
cd99b1bc4f
1 changed files with 7 additions and 6 deletions
|
@ -54,12 +54,13 @@ def top_menu(context, parent, calling_page=None):
|
||||||
menuitems = parent.get_children().live().in_menu().specific()
|
menuitems = parent.get_children().live().in_menu().specific()
|
||||||
for menuitem in menuitems:
|
for menuitem in menuitems:
|
||||||
menuitem.show_dropdown = has_menu_children(menuitem)
|
menuitem.show_dropdown = has_menu_children(menuitem)
|
||||||
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
if calling_page:
|
||||||
if calling_page else False)
|
menuitem.active = (calling_page.url.startswith(menuitem.url)
|
||||||
try:
|
if calling_page else False)
|
||||||
menuitem.title = menuitem.trans_title
|
try:
|
||||||
except AttributeError:
|
menuitem.title = menuitem.trans_title
|
||||||
pass
|
except AttributeError:
|
||||||
|
pass
|
||||||
return {
|
return {
|
||||||
'calling_page': calling_page,
|
'calling_page': calling_page,
|
||||||
'menuitems': menuitems,
|
'menuitems': menuitems,
|
||||||
|
|
Loading…
Reference in a new issue