示例#1
0
 def test_adapt_sqlobject_to_storm(self):
     so_result_set = TestSQLObjectResultSet()
     self.assertTrue(
         ISQLObjectResultSet.providedBy(so_result_set))
     result_set = IResultSet(so_result_set)
     self.assertTrue(
         IResultSet.providedBy(result_set))
    def __getitem__(self, *args, **kwargs):
        """See `IResultSet`.

        :return: The decorated version of the returned value.
        """
        # Can be a value or result set...
        value = self.result_set.__getitem__(*args, **kwargs)
        naked_value = removeSecurityProxy(value)
        if IResultSet.providedBy(naked_value):
            return DecoratedResultSet(value, self.result_decorator,
                                      self.pre_iter_hook, self.slice_info)
        else:
            return self.decorate_or_none(value)
    def __getitem__(self, *args, **kwargs):
        """See `IResultSet`.

        :return: The decorated version of the returned value.
        """
        # Can be a value or result set...
        value = self.result_set.__getitem__(*args, **kwargs)
        naked_value = removeSecurityProxy(value)
        if IResultSet.providedBy(naked_value):
            return DecoratedResultSet(
                value, self.result_decorator, self.pre_iter_hook,
                self.slice_info)
        else:
            return self.decorate_or_none(value)
示例#4
0
 def test_adapt_sqlobject_to_storm(self):
     so_result_set = TestSQLObjectResultSet()
     self.assertTrue(ISQLObjectResultSet.providedBy(so_result_set))
     result_set = IResultSet(so_result_set)
     self.assertTrue(IResultSet.providedBy(result_set))