mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-21 13:25:53 +00:00
parent
764a10ca0a
commit
cec742b9e3
2 changed files with 17 additions and 0 deletions
|
|
@ -85,3 +85,11 @@ def test_hash_item():
|
|||
b = u'\n'.join(line for line in a.splitlines()
|
||||
if u'PRODID' not in line and u'VERSION' not in line)
|
||||
assert vobject.hash_item(a) == vobject.hash_item(b)
|
||||
|
||||
|
||||
def test_multiline_uid():
|
||||
a = (u'BEGIN:FOO\r\n'
|
||||
u'UID:123456789abcd\r\n'
|
||||
u' efgh\r\n'
|
||||
u'END:FOO\r\n')
|
||||
assert vobject.Item(a).uid == u'123456789abcdefgh'
|
||||
|
|
|
|||
|
|
@ -91,6 +91,15 @@ class Item(object):
|
|||
def uid(self):
|
||||
'''Global identifier of the item, across storages, doesn't change after
|
||||
a modification of the item.'''
|
||||
stack = [self.parsed]
|
||||
while stack:
|
||||
component = stack.pop()
|
||||
if not component:
|
||||
continue
|
||||
uid = component.get('UID', None)
|
||||
if uid:
|
||||
return uid
|
||||
stack.extend(component.subcomponents)
|
||||
|
||||
for line in self.raw.splitlines():
|
||||
if line.startswith(u'UID:'):
|
||||
|
|
|
|||
Loading…
Reference in a new issue