py-vobject / vobject

A full-featured Python package for parsing and creating iCalendar and vCard files
http://py-vobject.github.io/
28 stars 7 forks source link

NameError: name 'newFromBehavior' is not defined #77

Open AndCycle opened 1 week ago

AndCycle commented 1 week ago
    matchResult = processComponentPair(comp, rightComp)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python/3.12.7/lib/python3.12/site-packages/vobject/ics_diff.py", line 141, in processComponentPair
    left = newFromBehavior(leftComp.name)
           ^^^^^^^^^^^^^^^
NameError: name 'newFromBehavior' is not defined
da4089 commented 5 days ago

I've had a play with this tonight.

Fixing the reported bug is simple, but ... it seems like the tool itself doesn't work very well when presented with significantly different input files.

I can definitely see the value in such functionality, but I feel like there's a heap of work to be done to bring this up to scratch. I'm going to explore a little more, and think about how to tackle that.

I'll probably post a quick fix for the reported issue first though. Most likely.

rsb-23 commented 4 days ago

Fix:

import vobject as vo

left = vo.newFromBehavior()

from vobjectx

da4089 commented 4 days ago

There's a couple of calls to parseOne() that need fixing too, but the real problem seems to be that the diffing implementation is bogus: give it two files where one has had a property value trivially changed, and it's ok. But give it two completely unrelated files, and it reports no differences.

I'll write that up with some examples in another bug, and push the simple import fixes here.