I am working with flask and redis. I've decided to try the rom redis orm (http://pythonhosted.org/rom/) to manage some mildly complex data structures. I have a list of objects, lets say:
urls = ['www.google.com', 'www.example.com', 'www.python.org']
I also have the rom model:
class Stored_url(rom.Model):
url = rom.String(required=True, unique=True, suffix=True)
salt = rom.String()
hash = rom.String()
created_at = rom.Float(default=time.time)
What is the best way to cycle through my urls, turning each into a Stored_url object?
For example the first object would look like:
url = "google.com"
salt = ""
hash = ""
created_at = "the current time"
Edit: the example in the docs has:
user = User(email='[email protected]')
user.salt, user.hash = gen_hash(password)
user.save()
# session.commit() or session.flush() works too