[Vobject] Pickle and vObject

Jeffrey Harris jeffrey at osafoundation.org
Fri Jun 6 19:46:07 CDT 2008


Hi Jonathan,

> I found that if I called "calendar.transformChildrenFromNative"
> before I attempted to pickle the calendar, I could nearly pickle and
> unpickle the calendar. Rather than mucking around with time zone
> objects, I found that I could make everything work if I changed
> the `__getattr__` method of `Component` in `base.py` of vobject as
> follows:
 >
> It appears that this solves my issues, and I am now able to pickle
> and unpickle calendar objects for my cache.  It does seem to speed
> things up quite a bit!

I'm a wee bit surprised that transforming back to native isn't hurting 
you, but I'm glad!

> How would you feel about accepting this change in vObject?

Thanks for the patch!  Ideally, I like to get patches as diffs (best: 
the output of svn diff), but I'll take what I can get. ;)

When I looked at your patch, though, I realized the real problem was 
that when pickle puts itself back together, it doesn't call __init__, 
which means obj.contents doesn't exist, which means my __getattr__ 
infinite loops.  I just added a special case for contents and that 
should fix your problem.

I didn't release a new version, are you OK grabbing vobject from SVN?

I also added a bit of logic so that IPython's tab-completion works with 
vobject's custom __getattr__, the lack of tab completion for vobject had 
been bugging me for years...

Sincerely,
Jeffrey


More information about the VObject mailing list