appobject.py
changeset 2059 af33833d7571
parent 2058 7ef12c03447c
child 2144 51c84d585456
equal deleted inserted replaced
2058:7ef12c03447c 2059:af33833d7571
   202 
   202 
   203     # url generation methods ##################################################
   203     # url generation methods ##################################################
   204 
   204 
   205     controller = 'view'
   205     controller = 'view'
   206 
   206 
   207     def build_url(self, method=None, **kwargs):
   207     def build_url(self, *args, **kwargs):
   208         """return an absolute URL using params dictionary key/values as URL
   208         """return an absolute URL using params dictionary key/values as URL
   209         parameters. Values are automatically URL quoted, and the
   209         parameters. Values are automatically URL quoted, and the
   210         publishing method to use may be specified or will be guessed.
   210         publishing method to use may be specified or will be guessed.
   211         """
   211         """
       
   212         # use *args since we don't want first argument to be "anonymous" to
       
   213         # avoid potential clash with kwargs
       
   214         if args:
       
   215             assert len(args) == 1, 'only 0 or 1 non-named-argument expected'
       
   216             method = args[0]
       
   217         else:
       
   218             method = None
   212         # XXX I (adim) think that if method is passed explicitly, we should
   219         # XXX I (adim) think that if method is passed explicitly, we should
   213         #     not try to process it and directly call req.build_url()
   220         #     not try to process it and directly call req.build_url()
   214         if method is None:
   221         if method is None:
   215             method = self.controller
   222             method = self.controller
   216             if method == 'view' and self.req.from_controller() == 'view' and \
   223             if method == 'view' and self.req.from_controller() == 'view' and \