From: Nick Retallack Date: Mon, 7 Dec 2009 02:31:22 +0000 (-0800) Subject: merged conflicting stuff. Added 'me' tag X-Git-Url: http://git.veekun.com/zzz-floof.git/commitdiff_plain/a6d7a53b0cc7a8f8629e8e1272a56d3c51179317?hp=20379253a8fa1326e175c0f0bb5faee4aeeea158 merged conflicting stuff. Added 'me' tag --- diff --git a/floof/config/routing.py b/floof/config/routing.py index f6906f4..7a0227a 100644 --- a/floof/config/routing.py +++ b/floof/config/routing.py @@ -22,8 +22,8 @@ def make_map(): require_POST = dict(conditions={'method': ['POST']}) # get rid of trailing slashes - map.redirect('/*(url)/', '/{url}', - _redirect_code='301 Moved Permanently') + # map.redirect('/*(url)/', '/{url}', + # _redirect_code='301 Moved Permanently') # The ErrorController route (handles 404/500 error pages); it should diff --git a/floof/controllers/art.py b/floof/controllers/art.py index 7c371ed..0b89d98 100644 --- a/floof/controllers/art.py +++ b/floof/controllers/art.py @@ -26,6 +26,7 @@ from wtforms import * class ArtUploadForm(Form): by = TextField('Artists') + by_me = BooleanField('me') file = FileField('Upload') url = TextField('Link') @@ -94,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: diff --git a/floof/lib/tags.py b/floof/lib/tags.py index 104fe65..d2adafc 100644 --- a/floof/lib/tags.py +++ b/floof/lib/tags.py @@ -1,4 +1,9 @@ from floof.model import Art, ArtUser, ArtUserType, Tag, TagText, User +import elixir +from dbhelpers import find_or_create +import re + +from pylons import c def parse(search_string): """Parses a search query, and returns a query object on Art. @@ -23,6 +28,8 @@ def parse(search_string): # This is a special tag; at the moment, by/for/of to indicate # related users prefix, tag = tag.split(':', 1) + if tag == 'me': + tag = c.user.name # XXX what to do if this fails? abort? return empty query? target_user = User.get_by(name=tag) diff --git a/floof/model/search.py b/floof/model/search.py index 37f2d5f..f03de51 100644 --- a/floof/model/search.py +++ b/floof/model/search.py @@ -24,7 +24,7 @@ class GalleryWidget(Entity): @property def string(self): - return self.search + return self.search.string @string.setter def string(self, value): diff --git a/floof/templates/art/new.mako b/floof/templates/art/new.mako index 2b18b42..0adc916 100644 --- a/floof/templates/art/new.mako +++ b/floof/templates/art/new.mako @@ -3,24 +3,40 @@

Add New Art

${h.form(h.url('create_art'), multipart=True)} +##<<<<<<< HEAD +##
+## ${normal_field(c.form.by)} +## ${checkbox_field(c.form.by_me)} +##
+## +##
${normal_field(c.form.file)}
+##======= ## Todo: write some macros to make outputting form fields easier. ${normal_field(c.form.file)} +##>>>>>>> origin/master ${h.submit(None, 'Upload!')} ${h.end_form()} +<%def name="field_errors(errors)"> + %if errors: + + %endif + + <%def name="normal_field(field)"> -
-${field.label()|n} -${field()|n} -%if field.errors: - -%endif -
+ ${field.label()|n} + ${field()|n} + ${field_errors(field.errors)} + +<%def name="checkbox_field(field)"> + ${field()|n} ${field.label()|n} + ${field_errors(field.errors)} + \ No newline at end of file diff --git a/floof/templates/art/show.mako b/floof/templates/art/show.mako index bf14dff..3ea3849 100644 --- a/floof/templates/art/show.mako +++ b/floof/templates/art/show.mako @@ -38,17 +38,11 @@ ${h.end_form()} ('Recipient', c.art.recipients), \ ('Participant', c.art.participants)): % for user in relations: -
  • ${label}: ${user.name} +
  • ${label}: ${user.name} % endfor % endfor -

    Add Relations

    -${h.form (h.url("create_relation", kind="by", art_id=c.art.id))} -By: ${h.text('username')} -${h.submit('add','Add')} -${h.end_form()} - ${comments.comment_block(c.art.discussion.comments)}