diff -r f94b41709ce6 -r b056a49c16dc rset.py --- a/rset.py Fri Apr 24 16:48:38 2009 +0200 +++ b/rset.py Fri Apr 24 17:04:14 2009 +0200 @@ -51,7 +51,9 @@ # set by the cursor which returned this resultset self.vreg = None self.req = None - + # actions cache + self._rsetactions = None + def __str__(self): if not self.rows: return '' % self.rql @@ -70,9 +72,19 @@ '\n'.join('%s (%s)' % (r, d) for r, d in zip(rows, self.description))) - @cached - def possible_actions(self): - return self.vreg.possible_vobjects('actions', self.req, self) + def possible_actions(self, **kwargs): + if self._rsetactions is None: + self._rsetactions = {} + if kwargs: + key = tuple(sorted(kwargs.iteritems())) + else: + key = None + try: + return self._rsetactions[key] + except KeyError: + actions = self.vreg.possible_vobjects('actions', self.req, self, **kwargs) + self._rsetactions[key] = actions + return actions def __len__(self): """returns the result set's size"""