diff options
| author | tom christie tom@tomchristie.com | 2011-01-27 21:09:25 +0000 |
|---|---|---|
| committer | tom christie tom@tomchristie.com | 2011-01-27 21:09:25 +0000 |
| commit | 216baa551fdce6394aa640ee0806c79b38658daf (patch) | |
| tree | 9d97c1f37e029b87df6e6f7eb5a617727cae37ae /flywheel/utils.py | |
| parent | e227c38b330988d71087759d13303215561808c6 (diff) | |
| download | django-rest-framework-216baa551fdce6394aa640ee0806c79b38658daf.tar.bz2 | |
Login/Logout and FlyWheel API link in HTML emitter
Diffstat (limited to 'flywheel/utils.py')
| -rw-r--r-- | flywheel/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/flywheel/utils.py b/flywheel/utils.py index 98d8e1ae..c0386871 100644 --- a/flywheel/utils.py +++ b/flywheel/utils.py @@ -2,11 +2,21 @@ import re import xml.etree.ElementTree as ET from django.utils.encoding import smart_unicode from django.utils.xmlutils import SimplerXMLGenerator +from django.core.urlresolvers import resolve try: import cStringIO as StringIO except ImportError: import StringIO + +def url_resolves(url): + """Return True if the given URL is mapped to a view in the urlconf, False otherwise.""" + try: + resolve(url) + except: + return False + return True + # From piston def coerce_put_post(request): """ |
