[Zope-dev] Generic filtering of objects

Robert Leftwich robert@leftfieldcorp.com
Tue, 23 Nov 1999 12:13:13 +1100


Robert Leftwich wrote:
>
>I have a requirement to be able to apply a user-definable filter to all the
>views on the object database. Obviously this would be best applied at a low
>a level as possible in order to minimise the impact on the application code
>and to be made as generic as possible for maximum flexibility.
>To save re-inventing the wheel, has anyone else had this requirement and if
>so how did you implement it ?
>

Phillip J. Eby wrote :
>
> Ty Sarna and I have come up with a concept for this, which we have not yet
> implemented, as we are still finalizing design details.  We
> believe that it
> could be made quite general.  The basic idea is that you have a
>
(Snip some excellent design/use case discussion [not to mention the odd head
spin :-) ]...)

I have been thinking about this on and off for the last week or so and I
wanted to bounce around an idea or two.

Given that one of the main criteria (for me, at least) is the ability to
apply different filters on a per user basis, I am contemplating adding a
filter keyword to the in and tree tags. There already exists a very
specialised filter in both of these tags (the skip_unauthorized flag - which
is a filter for unauthorised objects), so it should be easy to enhance this
to support a more generic filter of the type proposed by Philip and Ty.

The factors pushing me toward this solution are that filtering is generally
a UI-driven requirement and I felt very uncomfortable about retrieving
user-selected filters from the REQUEST variable at low levels in the code (I
was experimenting with filtering in the objectId() method of ObjectManager).
Not to mention that this solution only worked for ObjectManager associated
data and fails when you have lists or dictionaries or external data access
such as SQL.

Anyone have any thoughts or comments ?

Robert Leftwich