launchpad-dev team mailing list archive
-
launchpad-dev team
-
Mailing list archive
-
Message #03784
Generic Colletion?
Hi Jeroen,
> === added file 'lib/lp/services/database/collection.py'
> --- lib/lp/services/database/collection.py 1970-01-01 00:00:00 +0000
> +++ lib/lp/services/database/collection.py 2010-07-15 15:00:52 +0000
> @@ -0,0 +1,125 @@
> +# Copyright 2010 Canonical Ltd. This software is licensed under the
> +# GNU Affero General Public License version 3 (see the file LICENSE).
> +
> +"""A generic collection of database objects."""
> +
> +__metaclass__ = type
> +__all__ = [
> + 'Collection',
> + ]
> +
> +from zope.component import getUtility
> +
> +from storm.expr import Join, LeftJoin
> +
> +from canonical.launchpad.webapp.interfaces import (
> + DEFAULT_FLAVOR, IStoreSelector, MAIN_STORE)
> +
> +
> +class Collection(object):
> + """An arbitrary collection of database objects.
> +
> + Works as a Storm wrapper: create a collection based on another
> + collection, adding joins and select conditions to taste.
> +
> + As in any Storm query, you can select any mix of classes and
> + individual columns or other Storm expressions.
> + """
>
This looks very cool, but how does it relate with the BranchCollection
implementation that already implements such a pattern?
--
Francis J. Lacoste
francis.lacoste@xxxxxxxxxxxxx
Attachment:
signature.asc
Description: This is a digitally signed message part.
Follow ups