Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- from bulldog.dal import model
- k = model.Market.find_by_id(176231)
- # k.status is 'open' at this point.
- #
- # the .save() model method looks like so:
- #
- # def save(self):
- # s = Session()
- # s.add(self)
- # s.commit()
- print("-- Changing k.status from 'open' to 'closed'")
- k.status = 'closed'
- k.save()
- print()
- print("-- Changing k.status from 'open' to 'open'")
- k.status = 'open'
- k.save()
- print()
- # Accessing k.status first, will make it appear in 'unchanged', as expected
- print("-- Accessing k.status first, then changing from 'open' to 'open'...")
- k.status
- k.status = 'open'
- k.save()
- print()
- print("-- Changing k.status from 'open' to 'open'")
- k.status = 'open'
- k.save()
- print()
- print("-- Changing k.status from 'open' to 'closed'")
- k.status = 'closed'
- k.save()
- print()
- print("-- Changing k.status from 'closed' to 'open'")
- k.status = 'open'
- k.save()
- print()
- print("-- Loading a fresh model instance, then changing k.status from 'open' to 'open'")
- k = model.Market.find_by_id(176231)
- k.status = 'open'
- k.save()
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement