Ejemplo n.º 1
0
    def doIt(txn):
        home = yield txn.calendarHomeWithUID(principalUID)
        if home is None:
            print("No home for principal")
            returnValue(None)

        trash = yield home.getTrash()
        if trash is None:
            print("No trash available")
            returnValue(None)

        untrashedCollections = yield home.children(onlyInTrash=False)
        if len(untrashedCollections) == 0:
            print("No untrashed collections for:", prettyRecord(record))
            returnValue(None)

        for collection in untrashedCollections:
            displayName = displayNameForCollection(collection)
            children = yield trash.trashForCollection(collection._resourceID)
            if len(children) == 0:
                continue

            print("Trashed events in calendar \"{}\":".format(displayName.encode("utf-8")))
            for child in children:
                print()
                yield printEventDetails(child)
            print("")
Ejemplo n.º 2
0
    def doIt(txn):
        home = yield txn.calendarHomeWithUID(principalUID)
        if home is None:
            print("No home for principal")
            returnValue(None)

        trash = yield home.getTrash()
        if trash is None:
            print("No trash available")
            returnValue(None)

        untrashedCollections = yield home.children(onlyInTrash=False)
        if len(untrashedCollections) == 0:
            print("No untrashed collections for:", prettyRecord(record))
            returnValue(None)


        for collection in untrashedCollections:
            displayName = displayNameForCollection(collection)
            children = yield trash.trashForCollection(collection._resourceID)
            if len(children) == 0:
                continue

            print("Trashed events in calendar \"{}\":".format(displayName.encode("utf-8")))
            for child in children:
                print()
                yield printEventDetails(child)
            print("")
Ejemplo n.º 3
0
    def doIt(txn):
        home = yield txn.calendarHomeWithUID(principalUID)
        if home is None:
            print("No home for principal")
            returnValue(None)

        trash = yield home.getTrash()
        if trash is None:
            print("No trash available")
            returnValue(None)

        trashedCollections = yield home.children(onlyInTrash=True)
        if len(trashedCollections) == 0:
            print("No trashed collections for:", prettyRecord(record))
            returnValue(None)

        print("Trashed collections for:", prettyRecord(record))

        nowDT = datetime.datetime.utcnow()

        for collection in trashedCollections:
            displayName = displayNameForCollection(collection)
            whenTrashed = collection.whenTrashed()
            ago = nowDT - whenTrashed
            print()
            print("   Trashed {}:".format(agoString(ago)))
            print(
                "      \"{}\" (collection)  Recovery ID = {}".format(
                    displayName.encode("utf-8"), collection._resourceID
                )
            )
            startTime = whenTrashed - datetime.timedelta(minutes=5)
            children = yield trash.trashForCollection(
                collection._resourceID, start=startTime
            )
            print("         ...containing events:")
            for child in children:
                component = yield child.component()
                summary = component.mainComponent().propertyValue("SUMMARY", "<no title>")
                print("            \"{}\"".format(summary))
Ejemplo n.º 4
0
    def doIt(txn):
        home = yield txn.calendarHomeWithUID(principalUID)
        if home is None:
            print("No home for principal")
            returnValue(None)

        trash = yield home.getTrash()
        if trash is None:
            print("No trash available")
            returnValue(None)

        trashedCollections = yield home.children(onlyInTrash=True)
        if len(trashedCollections) == 0:
            print("No trashed collections for:", prettyRecord(record))
            returnValue(None)

        print("Trashed collections for:", prettyRecord(record))

        nowDT = datetime.datetime.utcnow()

        for collection in trashedCollections:
            displayName = displayNameForCollection(collection)
            whenTrashed = collection.whenTrashed()
            ago = nowDT - whenTrashed
            print()
            print("   Trashed {}:".format(agoString(ago)))
            print(
                "      \"{}\" (collection)  Recovery ID = {}".format(
                    displayName.encode("utf-8"), collection._resourceID
                )
            )
            startTime = whenTrashed - datetime.timedelta(minutes=5)
            children = yield trash.trashForCollection(
                collection._resourceID, start=startTime
            )
            print("         ...containing events:")
            for child in children:
                component = yield child.component()
                summary = component.mainComponent().propertyValue("SUMMARY", "<no title>")
                print("            \"{}\"".format(summary.encode("utf-8")))