PEP8 cleanups, unused imports and bumped version to 0.7.3

This commit is contained in:
Roberto Rosario
2011-06-08 01:39:38 -04:00
parent 8fa4f641e4
commit 30b1fea147
22 changed files with 35 additions and 52 deletions
+5 -5
View File
@@ -10,7 +10,7 @@ def register_multi_item_links(src, links, menu_name=None):
Register a multiple item action action to be displayed in the
generic list template
"""
multi_object_navigation.setdefault(menu_name, {})
if hasattr(src, '__iter__'):
for one_src in src:
@@ -24,8 +24,8 @@ def register_multi_item_links(src, links, menu_name=None):
def register_links(src, links, menu_name=None):
"""
Associate a link to a model a view, or an url
"""
"""
object_navigation.setdefault(menu_name, {})
if hasattr(src, '__iter__'):
for one_src in src:
@@ -41,7 +41,7 @@ def register_top_menu(name, link, children_views=None, children_path_regex=None,
Register a new menu entry for the main menu displayed at the top
of the page
"""
entry = {'link': link, 'name': name}
if children_views:
entry['children_views'] = children_views
@@ -58,7 +58,7 @@ def register_model_list_columns(model, columns):
Define which columns will be displayed in the generic list template
for a given model
"""
model_list_columns.setdefault(model, [])
model_list_columns[model].extend(columns)
@@ -25,19 +25,19 @@ class TopMenuNavigationNode(Node):
request = Variable('request').resolve(context)
current_path = request.META['PATH_INFO']
current_view = resolve_to_name(current_path)
all_menu_links = [entry.get('link', {}) for entry in top_menu_entries]
menu_links = resolve_links(context, all_menu_links, current_view, current_path)
for index, link in enumerate(top_menu_entries):
children_views = link.get('children_views', [])
if current_view in children_views:
menu_links[index]['active'] = True
children_path_regex = link.get('children_path_regex', [])
for child_path_regex in children_path_regex:
if re.compile(child_path_regex).match(current_path.lstrip('/')):
menu_links[index]['active'] = True
menu_links[index]['active'] = True
context['menu_links'] = menu_links
return ''
@@ -46,7 +46,7 @@ class TopMenuNavigationNode(Node):
@register.tag
def get_top_menu_links(parser, token):
return TopMenuNavigationNode()
def resolve_arguments(context, src_args):
args = []