X-Git-Url: http://git.veekun.com/zzz-floof.git/blobdiff_plain/b07336c562d537ea3407d6a1c9fcb280dae7f514..d2cfab09f98980d5c1d433a9e75eb65e0b13b0aa:/floof/controllers/art.py?ds=inline diff --git a/floof/controllers/art.py b/floof/controllers/art.py index ee1e4ad..0b89d98 100644 --- a/floof/controllers/art.py +++ b/floof/controllers/art.py @@ -1,13 +1,13 @@ import logging -from pylons import config, request, response, session, tmpl_context as c, h +from pylons import config, request, response, session, tmpl_context as c from pylons.controllers.util import abort, redirect from pylons import url from floof.lib.base import BaseController, render log = logging.getLogger(__name__) -from floof.lib import file_storage as storage +from floof.lib import file_storage as storage, helpers as h from floof.model import Art, Rating, ArtUser from floof.model.art import ArtUserType from floof.model.comments import Discussion @@ -18,7 +18,6 @@ import elixir import os.path import PIL import PIL.Image -from sqlalchemy import func from sqlalchemy.exceptions import IntegrityError from sqlalchemy.orm.exc import NoResultFound from wtforms.validators import ValidationError @@ -27,6 +26,7 @@ from wtforms import * class ArtUploadForm(Form): by = TextField('Artists') + by_me = BooleanField('me') file = FileField('Upload') url = TextField('Link') @@ -95,9 +95,17 @@ class ArtController(BaseController): ) c.art.discussion = Discussion(count=0) + # <<<<<<< HEAD + # if c.form.by_me and c.user not in c.form.by.data: + # UserRelation(user=c.user, creator=c.user, kind="by", art=c.art) + # + # for artist in c.form.by.data: + # UserRelation(user=artist, creator=c.user, kind="by", art=c.art) + # ======= # For the moment, cheerfully assume that people are uploading their own # art ArtUser(art=c.art, user=c.user, type=ArtUserType.BY) + # >>>>>>> origin/master try: @@ -139,8 +147,7 @@ class ArtController(BaseController): def watchstream(self, name): """Watchstream for a certain user.""" try: - c.watching_user = User.query.filter(func.lower(User.name) == name) \ - .one() + c.watching_user = User.get_by(name=name) except NoResultFound: abort(404)