Skip to content
Browse files

check for base_url to end with /

  • Loading branch information...
1 parent 51dc67c commit ac92ad544e85d897f7a38d80607cc2ae7fb68020 @rudyryk rudyryk committed Mar 26, 2013
Showing with 8 additions and 2 deletions.
  1. +4 −1 .gitignore
  2. +4 −1 smarter/__init__.py
View
5 .gitignore
@@ -1,12 +1,15 @@
+# temporary
.DS_Store*
Icon?
Thumbs.db
-
*.pyc
*.pyo
+# media & db
example/example/example.db
+example/example/media/*
+# dist & docs
dist/
docs/_build/
django_smarter.egg-info/
View
5 smarter/__init__.py
@@ -93,6 +93,9 @@ def register(self, views, model=None, base_url=None, prefix=None):
if not model:
raise Exception("Model is not specified, views must be registered for some model!")
+ if base_url and not base_url.endswith('/'):
+ raise Exception("`base_url` have to end with backslash ('/')")
+
for r in self._registered:
if r['model'] == model and r['views'] == views:
raise AlreadyRegistered()
@@ -107,7 +110,7 @@ def register(self, views, model=None, base_url=None, prefix=None):
prefix_bits.append(model_name)
if base_url:
- base_url = '^%s/' % (base_url.strip(' /') or model_name)
+ base_url = '^%s/' % (base_url.rstrip('/') or model_name)
else:
base_url = '^%s/' % model_name

0 comments on commit ac92ad5

Please sign in to comment.
Something went wrong with that request. Please try again.