I want to store dateutil.rrule objects in a database and recreate them after reading from the database.
Given the following problem, I think I need to use a workaround. Python dateutils print repeat rule according to iCalendar format (see RFC 5545)
I am going to save myrrule output. dict to the database as a string, and then, if necessary, recreate the rrule object.
This is what the dict looks like:
{'_cache_complete': False, '_byhour': (0,), '_wkst': 0, '_timeset': (datetime.time(0, 10),), '_bysecond': (0,), '_bymonthday': (), '_byweekno': None, '_bysetpos': None, '_cache': None, '_bymonth': None, '_bynweekday': ((4, 3),), '_tzinfo': None, '_byyearday': None, '_byweekday': None, '_byminute': (10,), '_len': 10, '_until': None, '_bynmonthday': (), '_dtstart': datetime.datetime(2012, 10, 13, 0, 10), '_count': 10, '_freq': 1, '_interval': 1, '_byeaster': None}
Is that a good idea? Any other suggestions?
How to restore python object from dictionary? Is python setattr () a better option or something simpler?
Should I use something like this instead? stack overflow