resync / resync-simulator

ResourceSync Change Simulator
11 stars 6 forks source link

InventoryDupeError when ChangeSet contains two Resources with same URIs #21

Closed behas closed 12 years ago

behas commented 12 years ago

A ChangeSet can contain a single Resouce multiple times; e.g., when different change events happen to the same resource, they might appear in the same changeset. At the moment it seems that the inventory checks for dupes by URI and throws an errors..

Eventlog: [http://localhost:8888/resources/11 | 2012-07-31T01:37:48.540428Z | 223 | 3779971f0e260fafcde58b7b83aa96f1 | None | 1 | CREATE ] Eventlog: [http://localhost:8888/resources/2 | 2012-07-31T01:37:50.540776Z | 499 | 5dfabb44f9685ba6a9d03077158086de | None | 2 | UPDATE ] Eventlog: [http://localhost:8888/resources/12 | 2012-07-31T01:37:52.542052Z | 908 | 670143a18c296bf19ce3a44d1a2f6bc5 | None | 3 | CREATE ] Eventlog: [http://localhost:8888/resources/12 | 2012-07-31T01:37:54.542947Z | 908 | 670143a18c296bf19ce3a44d1a2f6bc5 | None | 4 | DELETE ] Eventlog: [http://localhost:8888/resources/2 | 2012-07-31T01:37:56.551518Z | 499 | 5dfabb44f9685ba6a9d03077158086de | None | 5 | DELETE ] ERROR:root:Uncaught exception GET /changeset (::1) HTTPRequest(protocol='http', host='localhost:8888', method='GET', uri='/changeset', version='HTTP/1.1', remoteip='::1', body='', headers={'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip,deflate,sdch', 'Host': 'localhost:8888', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,/_;q=0.8', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_74) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11', 'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,;q=0.3', 'Connection': 'keep-alive', 'If-None-Match': '"bfa982c6b48d57c03758463424cfbc8fba266dce"'}) Traceback (most recent call last): File "/Library/Python/2.7/site-packages/tornado-2.3.post1-py2.7.egg/tornado/web.py", line 1021, in _execute getattr(self, self.request.method.lower())(_args, **kwargs) File "/Users/haslhofer/Documents/projects/resync/impl/simulator/resync/http.py", line 167, in get self.write(self.generate_changeset()) File "/Users/haslhofer/Documents/projects/resync/impl/simulator/resync/http.py", line 162, in generate_changeset changeset = self.changememory.generate(from_changeid=changeid) File "/Users/haslhofer/Documents/projects/resync/impl/simulator/resync/changememory.py", line 54, in generate inventory.add(change) File "/Users/haslhofer/Documents/projects/resync/impl/simulator/resync/inventory.py", line 69, in add self._add(resource,replace) File "/Users/haslhofer/Documents/projects/resync/impl/simulator/resync/inventory.py", line 75, in _add raise InventoryDupeError("Attempt to add resource already in inventory") InventoryDupeError: Attempt to add resource already in inventory