-
Notifications
You must be signed in to change notification settings - Fork 12
Ensure that Item.folder works in all cases. #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1297,7 +1297,7 @@ def check_folder(folder): | |
| def item(self, entryid): | ||
| """ Return :class:`Item` with given entryid; raise exception of not found """ # XXX better exception? | ||
|
|
||
| item = Item() # XXX copy-pasting.. | ||
| item = Item(parent=self) # XXX copy-pasting.. | ||
| item.store = self | ||
| item.server = self.server | ||
| item.mapiobj = _openentry_raw(self.mapiobj, entryid.decode('hex'), MAPI_MODIFY) | ||
|
|
@@ -1439,7 +1439,7 @@ def container_class(self, value): | |
| def item(self, entryid): | ||
| """ Return :class:`Item` with given entryid; raise exception of not found """ # XXX better exception? | ||
|
|
||
| item = Item() # XXX copy-pasting.. | ||
| item = Item(parent=self) # XXX copy-pasting.. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay, so this should work and make things faster. note that in 7.2, we renamed 'parent' into 'folder' for clarity. |
||
| item.store = self.store | ||
| item.server = self.server | ||
| item.mapiobj = _openentry_raw(self.store.mapiobj, entryid.decode('hex'), MAPI_MODIFY) | ||
|
|
@@ -1459,7 +1459,7 @@ def items(self): | |
| if len(rows) == 0: | ||
| break | ||
| for row in rows: | ||
| item = Item() | ||
| item = Item(parent=self) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looks also fine then. |
||
| item.store = self.store | ||
| item.server = self.server | ||
| item.mapiobj = _openentry_raw(self.store.mapiobj, PpropFindProp(row, PR_ENTRYID).Value, MAPI_MODIFY) | ||
|
|
@@ -1692,6 +1692,8 @@ def __init__(self, parent=None, eml=None, ics=None, vcf=None, load=None, loads=N | |
| self.emlfile = eml | ||
| if isinstance(parent, Folder): | ||
| self._folder = parent | ||
| else: | ||
| self._folder = None | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as you noted somewhere this has been fixed already. |
||
| # XXX | ||
| self._architem = None | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'self' is a Store, so not really the direct parent of the item.. but note that 'Item.folder' looks up the correct parent folder using PR_PARENT_ENTRYID.