Comment out GlasfaserMenu's getNodes method as it contains _get_placeholder method which no longer exists in the updated cms

This commit is contained in:
PCoder 2017-12-04 22:23:25 +01:00
parent ed810abb65
commit 4af2fc8fda

View file

@ -1,9 +1,9 @@
from menus.base import NavigationNode # from menus.base import NavigationNode
from menus.menu_pool import menu_pool from menus.menu_pool import menu_pool
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from cms.menu_bases import CMSAttachMenu from cms.menu_bases import CMSAttachMenu
from cms.templatetags.cms_tags import _get_placeholder # from cms.templatetags.cms_tags import _get_placeholder
from cms.utils.plugins import get_plugins # from cms.utils.plugins import get_plugins
class GlasfaserMenu(CMSAttachMenu): class GlasfaserMenu(CMSAttachMenu):
@ -12,51 +12,52 @@ class GlasfaserMenu(CMSAttachMenu):
def get_nodes(self, request): def get_nodes(self, request):
nodes = [] nodes = []
glasfaser_cms = 'ungleich_page/glasfaser_cms_page.html' # TODO: Find an alternative for _get_placeholder function
if (request and request.current_page and # glasfaser_cms = 'ungleich_page/glasfaser_cms_page.html'
request.current_page.get_template() == glasfaser_cms): # if (request and request.current_page and
template_context = { # request.current_page.get_template() == glasfaser_cms):
"request": request, # template_context = {
} # "request": request,
placeholder_name_list = [ # }
'Top Section', 'Middle Section', 'Glasfaser Services', # placeholder_name_list = [
'Glasfaser About', 'Contact Section' # 'Top Section', 'Middle Section', 'Glasfaser Services',
] # 'Glasfaser About', 'Contact Section'
plugins_list = [ # ]
'SectionWithImage', 'UngelichContactUsSection', # plugins_list = [
'UngelichTextSection', 'Service', 'About' # 'SectionWithImage', 'UngelichContactUsSection',
] # 'UngelichTextSection', 'Service', 'About'
for placeholder_name in placeholder_name_list: # ]
placeholder = _get_placeholder( # for placeholder_name in placeholder_name_list:
request.current_page, request.current_page, # placeholder = _get_placeholder(
template_context, placeholder_name # request.current_page, request.current_page,
) # template_context, placeholder_name
plugins = get_plugins( # )
request, placeholder, request.current_page.get_template() # plugins = get_plugins(
) # request, placeholder, request.current_page.get_template()
for plugin in plugins: # )
if type(plugin).__name__ in plugins_list: # for plugin in plugins:
section_hash = request.build_absolute_uri() # if type(plugin).__name__ in plugins_list:
if hasattr(plugin, 'menu_text'): # section_hash = request.build_absolute_uri()
menu_text = plugin.menu_text # if hasattr(plugin, 'menu_text'):
if menu_text.strip() == '': # menu_text = plugin.menu_text
continue # if menu_text.strip() == '':
menu_words = menu_text.split() # continue
if len(menu_words) > 0: # menu_words = menu_text.split()
section_hash = '{}#{}'.format( # if len(menu_words) > 0:
section_hash, # section_hash = '{}#{}'.format(
menu_words[0] # section_hash,
) # menu_words[0]
else: # )
continue # else:
newnode = NavigationNode( # continue
menu_text, # newnode = NavigationNode(
url=section_hash, # menu_text,
id="{}-{}".format( # url=section_hash,
request.current_page.id, plugin.id # id="{}-{}".format(
) # request.current_page.id, plugin.id
) # )
nodes.append(newnode) # )
# nodes.append(newnode)
return nodes return nodes