update:
even orientation is gone, now the code is:
class VentesHandler(BaseHandler):
@tornado.web.authenticated
def get(self):
user = self.get_secure_cookie("mechtari")
info = tornado.escape.json_decode(user)
email = info["personnel"]["email"]
try:
produits = self.db.users.find({"personnel.email":email},
{"produit_up":1, "_id":0}).distinct("produit_up")
print produits
renderer = self.fs
except (errors.AutoReconnect, errors.ConnectionFailure):
self.redirect("/error")
self.render("ventes.html", produits=produits,
renderer=renderer)
the template:
{% for produit in produits %}
<div class="produit">
{% from bson import ObjectId %}
{% if produit["avatar"]["orientation"]=="portrait" %}
<span><img src="/{{renderer.get(ObjectId(produit["avatar"]
["photo"])).filename}}" height="300px" class="imag">
{% else %}
<span><img src="/{{renderer.get(ObjectId(produit["avatar"]
["photo"])).filename}}" width="300px"class="imag">
{% end %}
</div>
{% end %}