in hosting/server/icons.py [0:0]
def get(id, user, cache, apps):
debug('icons.py::get::id', id)
if isNull(id):
return (("'feed", ("'title", "Icons"), ("'id", "icons")),)
# Get the requested app
app = apps.get(id)
if isNull(app):
debug('icons.py::get', 'app not found', id)
# Return a default new icon
return mkentry(car(id), car(id), user.get(()), now(), ())
# Get the requested icon
icon = cache.get(iconid(id))
if isNull(icon):
debug('icons.py::get', 'icon not found', id)
# Return a default new icon
return mkentry(title(app), car(id), author(app), now(), ())
# Get image, token, and updated date from icon
def image(c):
img = assoc("'image", c)
return None if isNull(img) else cadr(img)
def token(c):
tok = assoc("'token", c)
return None if isNull(tok) else cadr(tok)
img = image(content(icon))
tok = token(content(icon))
# Return the icon
iconc = (() if isNull(img) else (("'image", img),)) + (() if isNull(tok) or (user.get(()) != author(app) and user.get(()) != 'admin') else (("'token", tok),))
if isNull(iconc):
iconentry = mkentry(title(app), car(id), author(app), updated(icon), ())
debug('icons.py::get::iconentry', iconentry)
return iconentry
iconentry = mkentry(title(app), car(id), author(app), updated(icon), ("'icon",) + iconc)
debug('icons.py::get::iconentry', iconentry)
return iconentry