projects
/
zzz-floof.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added partial support for comment threading.
[zzz-floof.git]
/
floof
/
lib
/
helpers.py
diff --git
a/floof/lib/helpers.py
b/floof/lib/helpers.py
index
84c3394
..
1c2f0c1
100644
(file)
--- a/
floof/lib/helpers.py
+++ b/
floof/lib/helpers.py
@@
-8,6
+8,7
@@
available to Controllers. This module is available to both as 'h'.
# from webhelpers.html.tags import checkbox, password
from webhelpers import *
from routes import url_for, redirect_to
# from webhelpers.html.tags import checkbox, password
from webhelpers import *
from routes import url_for, redirect_to
+from pylons import url
# Scaffolding helper imports
from webhelpers.html.tags import *
# Scaffolding helper imports
from webhelpers.html.tags import *
@@
-21,7
+22,7
@@
def get_object_or_404(model, **kw):
from pylons.controllers.util import abort
"""
Returns object, or raises a 404 Not Found is object is not in db.
from pylons.controllers.util import abort
"""
Returns object, or raises a 404 Not Found is object is not in db.
- Uses elixir-specific `get_by()` convenience function (see elixir source:
+ Uses elixir-specific `get_by()` convenience function (see elixir source:
http://elixir.ematia.de/trac/browser/elixir/trunk/elixir/entity.py#L1082)
Example: user = get_object_or_404(model.User, id = 1)
"""
http://elixir.ematia.de/trac/browser/elixir/trunk/elixir/entity.py#L1082)
Example: user = get_object_or_404(model.User, id = 1)
"""
@@
-30,3
+31,9
@@
def get_object_or_404(model, **kw):
abort(404)
return obj
abort(404)
return obj
+def get_comment_owner_url(**route):
+ """Given a view route, returns the owner_url route parameter for generating
+ comment URLs.
+ """
+ # url() returns URLs beginning with a slash. We just need to strip it.
+ return url(**route)[1:]