Skip to content

Commit

Permalink
change namings to be more flask-y
Browse files Browse the repository at this point in the history
  • Loading branch information
tino097 committed Oct 12, 2017
1 parent 2ac8231 commit e27eb27
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions ckan/lib/helpers.py
Expand Up @@ -699,9 +699,9 @@ def _link_active_pylons(kwargs):


def _link_active_flask(kwargs):
controller, action = request.url_rule.endpoint.split('.')
return(kwargs.get('controller') == controller and
kwargs.get('action') == action)
blueprint, endpoint = request.url_rule.endpoint.split('.')
return(kwargs.get('controller') == blueprint and
kwargs.get('action') == endpoint)


def _link_to(text, *args, **kwargs):
Expand Down Expand Up @@ -753,9 +753,9 @@ def nav_link(text, *args, **kwargs):
def nav_link_flask(text, *args, **kwargs):
if len(args) > 1:
raise Exception('Too many unnamed parameters supplied')
controller, action = request.url_rule.endpoint.split('.')
blueprint, endpoint = request.url_rule.endpoint.split('.')
if args:
kwargs['controller'] = controller or None
kwargs['controller'] = blueprint or None
named_route = kwargs.pop('named_route', '')
if kwargs.pop('condition', True):
if named_route:
Expand Down Expand Up @@ -963,9 +963,9 @@ def get_facet_items_dict(facet, limit=None, exclude_active=False):
if hasattr(c, 'search_facets_limits'):
if c.search_facets_limits and limit is None:
limit = c.search_facets_limits.get(facet)
# zero treated as infinite for hysterical raisins
if limit is not None and limit > 0:
return facets[:limit]
# zero treated as infinite for hysterical raisins
if limit is not None and limit > 0:
return facets[:limit]
return facets


Expand Down Expand Up @@ -2550,9 +2550,11 @@ def mail_to(email_address, name):
def radio(selected, id, checked):
if checked:
return literal((u'<input checked="checked" id="%s_%s" name="%s" \
value="%s" type="radio">') % (selected, id, selected, id))
value="%s" type="radio">'
) % (selected, id, selected, id))
return literal(('<input id="%s_%s" name="%s" \
value="%s" type="radio">') % (selected, id, selected, id))
value="%s" type="radio">'
) % (selected, id, selected, id))


core_helper(flash, name='flash')
Expand Down

0 comments on commit e27eb27

Please sign in to comment.