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
class ArtUploadForm(Form):
by = TextField('Artists')
+ by_me = BooleanField('me')
file = FileField('Upload')
url = TextField('Link')
)
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:
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.
# 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)
@property
def string(self):
- return self.search
+ return self.search.string
@string.setter
def string(self, value):
<h1>Add New Art</h1>
${h.form(h.url('create_art'), multipart=True)}
+##<<<<<<< HEAD
+##<div>
+## ${normal_field(c.form.by)}
+## ${checkbox_field(c.form.by_me)}
+##</div>
+##
+##<div>${normal_field(c.form.file)}</div>
+##=======
## 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:
+ <ul class="errors">
+ %for error in errors:
+ <li>${error}
+ %endfor
+ </ul>
+ %endif
+</%def>
+
<%def name="normal_field(field)">
-<div>
-${field.label()|n}
-${field()|n}
-%if field.errors:
-<ul class="errors">
-%for error in field.errors:
-<li>${error}
-%endfor
-</ul>
-%endif
-</div>
+ ${field.label()|n}
+ ${field()|n}
+ ${field_errors(field.errors)}
</%def>
+
+<%def name="checkbox_field(field)">
+ ${field()|n} ${field.label()|n}
+ ${field_errors(field.errors)}
+</%def>
\ No newline at end of file
('Recipient', c.art.recipients), \
('Participant', c.art.participants)):
% for user in relations:
-<li>${label}: ${user.name}
+<li>${label}: <a href="${h.url('user_page', name=user.name)}">${user.name}</a>
% endfor
% endfor
</ul>
-<h2>Add Relations</h2>
-${h.form (h.url("create_relation", kind="by", art_id=c.art.id))}
-By: ${h.text('username')}
-${h.submit('add','Add')}
-${h.end_form()}
-
<img class="full" src="${h.storage_url('art/medium', c.art.hash)}">
${comments.comment_block(c.art.discussion.comments)}