360 if breadcrumbs: |
360 if breadcrumbs: |
361 return breadcrumbs.pop() |
361 return breadcrumbs.pop() |
362 return self.base_url() |
362 return self.base_url() |
363 |
363 |
364 def user_rql_callback(self, rqlargs, *args, **kwargs): |
364 def user_rql_callback(self, rqlargs, *args, **kwargs): |
365 """register a user callback to execute some rql query and return an url |
365 """register a user callback to execute some rql query, and return a URL |
366 to call it ready to be inserted in html. |
366 to call that callback which can be inserted in an HTML view. |
367 |
367 |
368 rqlargs should be a tuple containing argument to give to the execute function. |
368 `rqlargs` should be a tuple containing argument to give to the execute function. |
|
369 |
|
370 The first argument following rqlargs must be the message to be |
|
371 displayed after the callback is called. |
369 |
372 |
370 For other allowed arguments, see :meth:`user_callback` method |
373 For other allowed arguments, see :meth:`user_callback` method |
371 """ |
374 """ |
372 def rqlexec(req, rql, args=None, key=None): |
375 def rqlexec(req, rql, args=None, key=None): |
373 req.execute(rql, args, key) |
376 req.execute(rql, args, key) |
374 return self.user_callback(rqlexec, rqlargs, *args, **kwargs) |
377 return self.user_callback(rqlexec, rqlargs, *args, **kwargs) |
375 |
378 |
376 def user_callback(self, cb, cbargs, *args, **kwargs): |
379 def user_callback(self, cb, cbargs, *args, **kwargs): |
377 """register the given user callback and return an url to call it ready |
380 """register the given user callback and return a URL which can |
378 to be inserted in html. |
381 be inserted in an HTML view. When the URL is accessed, the |
|
382 callback function will be called (as 'cb(req, *cbargs)', and a |
|
383 message will be displayed in the web interface. The third |
|
384 positional argument must be 'msg', containing the message. |
379 |
385 |
380 You can specify the underlying js function to call using a 'jsfunc' |
386 You can specify the underlying js function to call using a 'jsfunc' |
381 named args, to one of :func:`userCallback`, |
387 named args, to one of :func:`userCallback`, |
382 ':func:`userCallbackThenUpdateUI`, ':func:`userCallbackThenReloadPage` |
388 ':func:`userCallbackThenUpdateUI`, ':func:`userCallbackThenReloadPage` |
383 (the default). Take care arguments may vary according to the used |
389 (the default). Take care arguments may vary according to the used |