projects
/
zzz-floof.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
merged suff, commented out some of my own
[zzz-floof.git]
/
floof
/
lib
/
helpers.py
diff --git
a/floof/lib/helpers.py
b/floof/lib/helpers.py
index
b4cac1f
..
14f92d0
100644
(file)
--- a/
floof/lib/helpers.py
+++ b/
floof/lib/helpers.py
@@
-8,7
+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
+from pylons import
config,
url
# Scaffolding helper imports
from webhelpers.html.tags import *
# Scaffolding helper imports
from webhelpers.html.tags import *
@@
-18,6
+18,8
@@
import sqlalchemy.types as types
flash = Flash()
# End of.
flash = Flash()
# End of.
+from floof.lib import file_storage as storage
+
def get_object_or_404(model, **kw):
from pylons.controllers.util import abort
"""
def get_object_or_404(model, **kw):
from pylons.controllers.util import abort
"""
@@
-34,10
+36,14
@@
def get_object_or_404(model, **kw):
def get_comment_owner_url(**route):
"""Given a view route, returns the owner_url route parameter for generating
comment URLs.
def get_comment_owner_url(**route):
"""Given a view route, returns the owner_url route parameter for generating
comment URLs.
- """
+ """
if 'owner_url' in route:
# We're already in a comments page. Reuse the existing owner URL
return route['owner_url']
# url() returns URLs beginning with a slash. We just need to strip it.
return url(**route)[1:]
if 'owner_url' in route:
# We're already in a comments page. Reuse the existing owner URL
return route['owner_url']
# url() returns URLs beginning with a slash. We just need to strip it.
return url(**route)[1:]
+
+def storage_url(prefix, identifier):
+ """Returns a URL for the given object-in-storage."""
+ return storage.get_path(prefix, identifier)