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. --- CHANGES.txt | 5 +++++ repoze/bfg/url.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index c67e243fe..fa09f8089 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,6 +1,11 @@ Next release ============ +Documentation +------------- + +- Add examples to ``repoze.bfg.url.model_url`` docstring. + Templates --------- 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