Skip to content

Commit

Permalink
Avoid spamming users on schema updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
fatlotus committed Dec 17, 2015
1 parent 2bb6dd3 commit c3e1cd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions caravel/model/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from caravel.model.moderation import ModeratedMixin
from caravel.model.temporal import TimeOrderMixin
from caravel.model.categories import CategoriesMixin
from caravel.model.attachments import PhotosMixin
from caravel.model.attachments import PhotosMixin, Photo
from caravel.model.migration import SchemaMixin
from caravel.model.priced import PriceMixin
from caravel.model.principal import PrincipalMixin
Expand Down Expand Up @@ -62,4 +62,6 @@ def to_ndb_schema(listing):
listing.categories = [re.sub(r'^category:', '', x) for x in
listing.categories]

# listing.photos = [Photo(x) for x in listing.photos_]
listing.photos = [
Photo(re.sub(r'-large$', '', p.path)) for p in listing.photos]
listing.run_trigger = True
4 changes: 4 additions & 0 deletions caravel/tests/test_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def test_migrate_from_old(self):
listing = Listing.get_by_key_name("my-listing-name")
self.assertEquals(listing.version, 11)

# Verify that no emails were sent.
self.assertEquals(self.emails, [])

def test_migrate_from_super_old(self):

Expand Down Expand Up @@ -100,3 +102,5 @@ def test_migrate_from_super_old(self):
self.assertEquals(listing.body, u"Body of Legacy \xe2\x98\x86")
self.assertEquals(listing.categories, ["miscellaneous"])

# Verify that no emails were sent.
self.assertEquals(self.emails, [])

0 comments on commit c3e1cd0

Please sign in to comment.