app/soc/views/sitemap/sidebar.py
author Sverre Rabbelier <srabbelier@gmail.com>
Sat, 29 Nov 2008 19:45:19 +0000
changeset 614 53a3e46fc512
parent 589 ee9122db04af
child 615 1d09147de51f
permissions -rw-r--r--
Moved getSidebarLinks to sitemap.sidebar This is the fourth, and final patch, that attempts to improve the cohesion in the base.View class. Patch by: Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
493
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
     1
#!/usr/bin/python2.5
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
     2
#
31
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
# Copyright 2008 the Melange authors.
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
#
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
# Licensed under the Apache License, Version 2.0 (the "License");
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
# you may not use this file except in compliance with the License.
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
# You may obtain a copy of the License at
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
#
493
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
     9
#   http://www.apache.org/licenses/LICENSE-2.0
31
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
#
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
# Unless required by applicable law or agreed to in writing, software
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
# distributed under the License is distributed on an "AS IS" BASIS,
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
# See the License for the specific language governing permissions and
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
# limitations under the License.
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
493
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
    17
"""Sidebar
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
    18
"""
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
    19
31
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
__authors__ = [
493
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
    21
    '"Sverre Rabbelier" <sverre@rabbelier.nl>',
31
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    22
  ]
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    23
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    24
493
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
    25
SIDEBAR = []
226
a92b11181a49 Update some of the URL patterns to get their link_name parsing from the new
Todd Larsen <tlarsen@google.com>
parents: 205
diff changeset
    26
31
8b43c541afa7 First iteration of a "prototype" Melange app, along with an initial Person
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    27
585
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    28
def addMenu(callback):
493
6976c4d8d0ac Refactor the sidebar to use Django templates
Sverre Rabbelier <srabbelier@gmail.com>
parents: 284
diff changeset
    29
  global SIDEBAR
585
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    30
  SIDEBAR.append(callback)
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    31
586
a4a36b06a870 Make the sidebar dynamic depending on the user's rights
Sverre Rabbelier <srabbelier@gmail.com>
parents: 585
diff changeset
    32
def getSidebar(request):
585
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    33
  sidebar = []
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    34
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    35
  for callback in SIDEBAR:
586
a4a36b06a870 Make the sidebar dynamic depending on the user's rights
Sverre Rabbelier <srabbelier@gmail.com>
parents: 585
diff changeset
    36
    menu = callback(request)
589
ee9122db04af Fixes empty spaces appearing in the menu if a person is not allowed to see this menu or if no menu is defined.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 586
diff changeset
    37
    
ee9122db04af Fixes empty spaces appearing in the menu if a person is not allowed to see this menu or if no menu is defined.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 586
diff changeset
    38
    if menu:
ee9122db04af Fixes empty spaces appearing in the menu if a person is not allowed to see this menu or if no menu is defined.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 586
diff changeset
    39
      # only if there is a menu we should append it
ee9122db04af Fixes empty spaces appearing in the menu if a person is not allowed to see this menu or if no menu is defined.
Lennard de Rijk <ljvderijk@gmail.com>
parents: 586
diff changeset
    40
      sidebar.append(menu)
585
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    41
903890857ed8 Have the sidebar be rebuilt on every request with callbacks
Sverre Rabbelier <srabbelier@gmail.com>
parents: 493
diff changeset
    42
  return sidebar
614
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    43
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    44
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    45
def getSidebarItems(params):
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    46
  """Retrieves a list of sidebar entries for this view
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    47
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    48
  Params usage:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    49
    The params dictionary is provided to the menu_text's format.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    50
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    51
    sidebar: The sidebar value is returned directly if non-False
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    52
    sidebar_defaults: The sidebar_defaults are used to construct the
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    53
      sidebar items for this View. It is expected to be a tuple of
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    54
      three items, the item's url, it's menu_text, and it's
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    55
      access_type, see getSidebarLinks on how access_type is used.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    56
    sidebar_additional: The sidebar_additional values are appended
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    57
      to the list of items verbatim, and should be in the format
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    58
      expected by getSidebarLinks.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    59
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    60
  Args:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    61
    params: a dict with params for this View.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    62
  """
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    63
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    64
  # Return the found result
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    65
  if params['sidebar']:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    66
    return params['sidebar']
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    67
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    68
  # Construct defaults manualy
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    69
  defaults = params['sidebar_defaults']
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    70
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    71
  result = []
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    72
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    73
  for url, menu_text, access_type in defaults:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    74
    url = url % params['url_name'].lower()
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    75
    item = (url, menu_text % params, access_type)
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    76
    result.append(item)
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    77
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    78
  for item in params['sidebar_additional']:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    79
    result.append(item)
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    80
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    81
  return result
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    82
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    83
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    84
def getSidebarLinks(request, params=None):
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    85
  """Returns an dictionary with one sidebar entry.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    86
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    87
  Calls getSidebarItems to retrieve the items that should be in the
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    88
  menu. Expected is a tuple with an url, a menu_text, and an
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    89
  access_type. The access_type is then passed to checkAccess, if it
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    90
  raises out_of_band.Error, the item will not be added.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    91
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    92
  Args:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    93
    request: the django request object
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    94
    params: a dict with params for this View
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    95
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    96
  Params usage:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    97
    The params dictionary is passed as argument to getSidebarItems,
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    98
      see the docstring of getSidebarItems on how it uses it.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
    99
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   100
    rights: The rights dictionary is used to check if the user has
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   101
      the required rights to see a sidebar item.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   102
      See checkAccess for more details on how the rights dictionary
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   103
      is used to check access rights.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   104
    sidebar_heading: The sidebar_heading value is used to set the
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   105
      heading variable in the result.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   106
    name: The name value is used if sidebar_heading is not present.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   107
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   108
  Returns: A dictionary is returned with it's 'heading' value set
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   109
    as explained above. It's 'items' value is constructed by
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   110
    calling _getSidebarItems. It constists of dictionaries with a
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   111
    url and a title field.
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   112
  """
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   113
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   114
  rights = params['rights']
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   115
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   116
  items = []
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   117
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   118
  for url, menu_text, access_type in getSidebarItems(params):
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   119
    try:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   120
      access.checkAccess(access_type, request, rights)
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   121
      items.append({'url': url, 'title': menu_text})
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   122
    except out_of_band.Error:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   123
      pass
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   124
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   125
  if not items:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   126
    return
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   127
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   128
  res = {}
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   129
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   130
  if 'sidebar_heading' not in params:
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   131
    params['sidebar_heading'] = params['name']
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   132
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   133
  res['heading'] = params['sidebar_heading']
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   134
  res['items'] = items
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   135
53a3e46fc512 Moved getSidebarLinks to sitemap.sidebar
Sverre Rabbelier <srabbelier@gmail.com>
parents: 589
diff changeset
   136
  return res