-
Notifications
You must be signed in to change notification settings - Fork 11
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
Script "delete_olditems.py" broken with recent __init__.py #34
Comments
do you mean that previously, when a folder given on the command-line does not exist for a user, it would be skipped, but now you get an error..? the variable 'mapi_value' was removed some time ago, and should probably be changed to 'mapiobj.Value'. not sure why we would actually need to look at PR_MESSAGE_DELIVERY_TIME though, since we have item.received. |
Sorry, I was not clear enough on this: The problem with "mapi_value.unixtime" applies only if option --verbose is used. I'm not too deep into MAPI, but the usage of mapi_value.unixtime might have to do with getMailAge is expecting a timestamp (instead of a datetime value). The folderfilter-problem could apply to other scripts, too - I haven't verified this, so far. |
so the folder is probably not directly under the 'subtree'? I guess the problem is that we changed the command-line parsing so you now have to specify a full 'path'. so for example if the folder is under 'Inbox', you have to specify something like --folder="Inbox/postgres". of course the Inbox itself can still be specified as ---folder="Inbox". hope this is not a problem for your use case? as for getMailAge, we now convert the timestamp to datetime, but the datetime is already available as item.received.. so I think it's the same as: getMailAge(item.received) def getMailAge(messagetime): |
...understand, yes, in this case it's "/Posteingang/Mailings/Postgres"
|
sorry for the late reply. what would you think of just giving the english names (such as "Inbox") special meaning? so for example, for "Inbox", we take store.inbox and so on. "Posteingang" will still work then if there's a "Posteingang", but it won't be localized. |
You mean, "/store.inbox/subfolder" would act as an alias for "/Posteingang/subfolder", "/Inbox/subfolder", "/Indbakke/subfolder" etc. ? |
yeah, the latter. it would find "Posteingang" or "Inbox" when filtering on "Inbox". so the name "Inbox" gets a bit of a special meaning. in previous implementations, it would only find "Inbox" I guess, but you were looking for "postgres" so it didn't matter what the inbox was called. |
I just re-factored the script to fix the first error and cleaned up the code. It seems that we can improve the output a lot, it might be interesting to list the free'd size and number of items. Example output: ==> finished dry run: 747 candidates (disk space saved: 4.8 GiB) We can probably also improve the performance, if we don't remove item per item, but a list of items per folder. I hope to discuss a fix for the folders with @srepmub monday ;) |
"for folder in user.store.folders(parse=True):" seems to have a problem:
...
"getMailAge(item.prop(PR_MESSAGE_DELIVERY_TIME).mapi_value.unixtime)" will fail, either.
Example:
[root@root scripts]# python ./delete_olditems.py --folder="postgres" --user="test" 10 --verbose
Running for user: test
Traceback (most recent call last):
File "./delete_olditems.py", line 57, in
main()
File "./delete_olditems.py", line 42, in main
for folder in user.store.folders(parse=True):
File "/usr/lib64/python2.6/site-packages/zarafa/init.py", line 1270, in folders
yield self.folder(path.decode(sys.stdin.encoding)) # XXX can optparse output unicode?
File "/usr/lib64/python2.6/site-packages/zarafa/init.py", line 1247, in folder
return self.subtree.folder(key, recurse=recurse, create=create)
File "/usr/lib64/python2.6/site-packages/zarafa/init.py", line 1596, in folder
raise ZarafaNotFoundException("no such folder: '%s'" % key)
zarafa.ZarafaNotFoundException: no such folder: 'postgres'
The text was updated successfully, but these errors were encountered: