TireSwingSoftware / openassign-server

OpenAssign server intended for use by a separate client via RPC
BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

View Builder causes error #146

Closed mhrivnak closed 12 years ago

mhrivnak commented 12 years ago

The view builder code is currently causing lots of errors. Below is a sample.

>>> sm = facade.managers.SessionManager()
>>> sm.detailed_surr_view(at)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/mhrivnak/git/openassign-server/pr_services/object_manager.py", line 822, in __repr__
    return repr(self.result)
  File "/home/mhrivnak/git/openassign-server/pr_services/object_manager.py", line 967, in result
    result = merge(result)
  File "/home/mhrivnak/git/openassign-server/pr_services/object_manager.py", line 608, in __call__
    ids = self._get_distinct_ids(map(itemgetter(foreign_key), result))
  File "/home/mhrivnak/git/openassign-server/pr_services/object_manager.py", line 569, in _get_distinct_ids
    result.update(value)
TypeError: 'NoneType' object is not iterable
jc0n commented 12 years ago

I know what the problem is but I'm surprised none of the tests caught that and/or why I'm not seeing the same problem. Still strange though, do you know why there is a None instead of an empty list or an integer for that foreign key being merged?

mhrivnak commented 12 years ago

I believe that this is the problem: view methods are returning results not in a list as before, but now in a CensoredView object, which is a collections.Sequence. pyamf doesn't know what to do with that and is choking.

mhrivnak commented 12 years ago

Passing this to @jc0n for review. Also, it would probably be a good idea to call at least one of these views from a service test so we can catch future issues like this.

jc0n commented 12 years ago

LGTM.