I am trying to return a list of items modified with each item also showing like the number of modifications.
Returning a list of user modified items was done easily but I would also like to display the item modified by the user and the modifications of that particular item. Typical way it coould be displayed like is, Modified item: No of modifications to it E.g. sl33k: 3 Some background of the base class methods used: list_revisions() - gets the list of ints of the all modification of a particular item get_revision() - given the modification int, it gets the specific modified item. item.name gives the name of the item The method takes for argument the list of items. I start by declaring a set() of the total modified items. Using for loop in the items and in the for loop for particular `int` modification of it, I collect the modified item. But, I get stuck around when I have to collect the no of modifications for one. The set is returned as a list to a template engine for the display. So, I would like to collect for each item, its no of modifications. How would I go about doing this? How would i return it with list of modified items tp display the above shown example? Any pointers will be much appreciated. Code: def foo(items): modified_items = set() rev_count = [] for item in items: item_name = item.name revnos = item.list_revisions() for revno in revnos: revision = item.get_revision(revno) if modications userid == loggedin users userid: contribution_items.add(item_name) # How do i collect revisions here return list(contribution_items) -- http://mail.python.org/mailman/listinfo/python-list