mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
Fix regression that broke replacing SR-image of same CSS name.
This commit is contained in:
@@ -1196,9 +1196,7 @@ class ApiController(RedditController):
|
||||
errors['BAD_CSS_NAME'] = _("bad image name")
|
||||
|
||||
if c.site.images and add_image_to_sr:
|
||||
if c.site.images.has_key(name):
|
||||
errors['IMAGE_ERROR'] = _("An image with that name already exists")
|
||||
elif c.site.get_num_images() >= g.max_sr_images:
|
||||
if c.site.get_num_images() >= g.max_sr_images:
|
||||
errors['IMAGE_ERROR'] = _("too many images (you only get %d)") % g.max_sr_images
|
||||
|
||||
if any(errors.values()):
|
||||
|
||||
@@ -43,7 +43,6 @@ import os.path
|
||||
import random
|
||||
|
||||
class SubredditExists(Exception): pass
|
||||
class ImageExists(Exception): pass
|
||||
|
||||
class Subreddit(Thing, Printable):
|
||||
# Note: As of 2010/03/18, nothing actually overrides the static_path
|
||||
@@ -582,15 +581,12 @@ class Subreddit(Thing, Printable):
|
||||
if max_num is not None and self.get_num_images() >= max_num:
|
||||
raise ValueError, "too many images"
|
||||
|
||||
if not self.images.has_key(name):
|
||||
# copy and blank out the images list to flag as _dirty
|
||||
l = self.images
|
||||
self.images = None
|
||||
# update the dictionary and rewrite to images attr
|
||||
l[name] = url
|
||||
self.images = l
|
||||
else:
|
||||
raise ImageExists, "image already exists"
|
||||
# copy and blank out the images list to flag as _dirty
|
||||
l = self.images
|
||||
self.images = None
|
||||
# update the dictionary and rewrite to images attr
|
||||
l[name] = url
|
||||
self.images = l
|
||||
|
||||
def del_image(self, name):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user