__init__.py
changeset 2059 af33833d7571
parent 1977 606923dff11b
child 2458 4d114865098f
equal deleted inserted replaced
2058:7ef12c03447c 2059:af33833d7571
   107         else:
   107         else:
   108             return None
   108             return None
   109 
   109 
   110     # url generation methods ##################################################
   110     # url generation methods ##################################################
   111 
   111 
   112     def build_url(self, method, base_url=None, **kwargs):
   112     def build_url(self, *args, **kwargs):
   113         """return an absolute URL using params dictionary key/values as URL
   113         """return an absolute URL using params dictionary key/values as URL
   114         parameters. Values are automatically URL quoted, and the
   114         parameters. Values are automatically URL quoted, and the
   115         publishing method to use may be specified or will be guessed.
   115         publishing method to use may be specified or will be guessed.
   116         """
   116         """
       
   117         # use *args since we don't want first argument to be "anonymous" to
       
   118         # avoid potential clash with kwargs
       
   119         assert len(args) == 1, 'only 0 or 1 non-named-argument expected'
       
   120         method = args[0]
       
   121         base_url = kwargs.pop('base_url', None)
   117         if base_url is None:
   122         if base_url is None:
   118             base_url = self.base_url()
   123             base_url = self.base_url()
   119         if '_restpath' in kwargs:
   124         if '_restpath' in kwargs:
   120             assert method == 'view', method
   125             assert method == 'view', method
   121             path = kwargs.pop('_restpath')
   126             path = kwargs.pop('_restpath')