Skip to content
Browse files

Added Error to Stylesheet API on invalid CSS

  • Loading branch information...
1 parent 82ed3c9 commit 117526abe3365b8e8911fd0935eab78dc069c600 @nekosune nekosune committed with spladug Nov 19, 2012
Showing with 3 additions and 0 deletions.
  1. +2 −0 r2/r2/controllers/api.py
  2. +1 −0 r2/r2/controllers/errors.py
View
2 r2/r2/controllers/api.py
@@ -1281,6 +1281,8 @@ def POST_subreddit_stylesheet(self, form, jquery,
form.set_html(".status", _('validation errors'))
form.set_html(".errors ul", ''.join(error_items))
form.find('.errors').show()
+ c.errors.add(errors.BAD_CSS, field="stylesheet_contents")
+ form.has_errors("stylesheet_contents", errors.BAD_CSS)
return
else:
form.find('.errors').hide()
View
1 r2/r2/controllers/errors.py
@@ -92,6 +92,7 @@
('NO_LINKS', _("that reddit only allows text posts")),
('TOO_OLD', _("that's a piece of history now; it's too late to reply to it")),
('BAD_CSS_NAME', _('invalid css name')),
+ ('BAD_CSS', _('invalid css')),
('BAD_REVISION', _('invalid revision ID')),
('TOO_MUCH_FLAIR_CSS', _('too many flair css classes')),
('BAD_FLAIR_TARGET', _('not a valid flair target')),

0 comments on commit 117526a

Please sign in to comment.
Something went wrong with that request. Please try again.