Mercurial > p > roundup > code
view roundup/cgi/PageTemplates/MultiMapping.py @ 3913:00896a2acaa5
clean up query display of "Private to you" items
Previously the handling of queries in the edit menu was a little wonky. If
you change a query to not be private to you then you lose the ability to
ever change it back to being private.
Previously the queries were displayed in three chunks: First all retired
queries. Then all queries private to the current user (this batch has the
dropdown for toggling private state). Then all non-private queries.
Now: all queries we created that are retired, all queries that we created
that are not retired, then all non-private queries not created by the
current user.
this should fix [SF#1481394]
| author | Justus Pendleton <jpend@users.sourceforge.net> |
|---|---|
| date | Thu, 20 Sep 2007 23:44:58 +0000 |
| parents | 81cb4860ca75 |
| children | 35ea9b1efc14 |
line wrap: on
line source
import operator class MultiMapping: def __init__(self, *stores): self.stores = list(stores) def __getitem__(self, key): for store in self.stores: if store.has_key(key): return store[key] raise KeyError, key _marker = [] def get(self, key, default=_marker): for store in self.stores: if store.has_key(key): return store[key] if default is self._marker: raise KeyError, key return default def __len__(self): return reduce(operator.add, [len(x) for x in self.stores], 0) def push(self, store): self.stores.append(store) def pop(self): return self.stores.pop() def items(self): l = [] for store in self.stores: l = l + store.items() return l
