From c8d6ab1c3dff10ea2151c6ee777dcf75ab84ee08 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Wed, 11 Nov 2009 19:26:25 +0000 Subject: - Add examples to ``repoze.bfg.url.model_url`` docstring. --- repoze/bfg/url.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'repoze') diff --git a/repoze/bfg/url.py b/repoze/bfg/url.py index d6f7970e5..746713563 100644 --- a/repoze/bfg/url.py +++ b/repoze/bfg/url.py @@ -132,6 +132,24 @@ def model_url(model, request, *elements, **kw): context of a URL dispatch; contexts found this way do not need to be location-aware. + Examples:: + + model_url(context, request) => + + http://example.com/ + + model_url(context, request, 'a.html') => + + http://example.com/a.html + + model_url(context, request, 'a.html', query={'q':'1'}) => + + http://example.com/a.html?q=1 + + model_url(context, request, 'a.html', anchor='abc') => + + http://example.com/#abc + Any positional arguments passed in as ``elements`` must be strings or unicode objects. These will be joined by slashes and appended to the generated model URL. Each of the elements passed in is -- cgit v1.2.3