@@ -1947,16 +1947,25 @@ def follow_count(obj_type, obj_id):
19471947 return logic .get_action (action )(context , {'id' : obj_id })
19481948
19491949
1950- def _create_url_with_params (params = None , controller = None , action = None ,
1951- extras = None ):
1952- ''' internal function for building urls with parameters. '''
1950+ def _create_url_with_params (
1951+ params = None , controller = None , action = None , extras = None
1952+ ):
1953+ """internal function for building urls with parameters."""
1954+ if extras is None :
1955+ if not controller and not action :
1956+ # it's an url for the current page. Let's keep all interlal params,
1957+ # like <package_type>
1958+ extras = dict (request .view_args )
1959+ else :
1960+ extras = {}
1961+
1962+ blueprint , view = p .toolkit .get_endpoint ()
19531963 if not controller :
1954- controller = getattr (c , ' controller' , False ) or request . blueprint
1964+ controller = getattr (g , " controller" , blueprint )
19551965 if not action :
1956- action = getattr (c , 'action' , False ) or p .toolkit .get_endpoint ()[1 ]
1957- if not extras :
1958- extras = {}
1959- endpoint = controller + '.' + action
1966+ action = getattr (g , "action" , view )
1967+
1968+ endpoint = controller + "." + action
19601969 url = url_for (endpoint , ** extras )
19611970 return _url_with_params (url , params )
19621971
0 commit comments