Stop writing subreddit images to old model.

This commit is contained in:
Neil Williams
2013-08-16 23:54:35 -07:00
parent 77c658b6ce
commit 8d4ba3971b
2 changed files with 1 additions and 44 deletions

View File

@@ -1655,8 +1655,6 @@ class ApiController(RedditController, OAuth2ResourceController):
# just in case we need to kill this feature from XSS
if g.css_killswitch:
return self.abort(403,'forbidden')
c.site.del_image(name)
c.site._commit()
wiki.ImagesByWikiPage.delete_image(c.site, "config/stylesheet", name)
ModAction.create(c.site, c.user, action='editsettings',
details='del_image', description=name)
@@ -1755,11 +1753,10 @@ class ApiController(RedditController, OAuth2ResourceController):
if header:
c.site.header = new_url
c.site.header_size = size
c.site._commit()
if add_image_to_sr:
c.site.add_image(name, url = new_url)
wiki.ImagesByWikiPage.add_image(c.site, "config/stylesheet",
name, new_url)
c.site._commit()
if header:
kw = dict(details='upload_image_header')

View File

@@ -191,7 +191,6 @@ class Subreddit(Thing, Printable, BaseSite):
stylesheet_modified=None,
header_size=None,
allow_top=False, # overridden in "_new"
images={},
reported=0,
valid_votes=0,
show_media=False,
@@ -831,41 +830,6 @@ class Subreddit(Thing, Printable, BaseSite):
user = c.user if c.user_is_loggedin else None
return self.can_view(user)
def add_image(self, name, url):
"""
Adds an image to the subreddit's image list. The resulting
number of the image is returned. Note that image numbers are
non-sequential insofar as unused numbers in an existing range
will be populated before a number outside the range is
returned.
raises ValueError if the resulting number is >= max_num.
The Subreddit will be _dirty if a new image has been added to
its images list, and no _commit is called.
"""
# 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):
"""
Deletes an image from the images dictionary assuming an image
of that name is in the current dictionary.
The Subreddit will be _dirty if image has been removed from
its images list, and no _commit is called.
"""
if self.images.has_key(name):
l = self.images
self.images = None
del l[name]
self.images = l
def __eq__(self, other):
if type(self) != type(other):
@@ -1155,10 +1119,6 @@ class DefaultSR(_DefaultSR):
def _fullname(self):
return "t5_6"
@property
def images(self):
return self._base.images
@property
def _id36(self):
return self._base._id36