Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install products.daterangeinrangeindex

How to install Products.DateRangeInRangeIndex

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install products.daterangeinrangeindex
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
Windows (64-bit)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
Mac OS X (10.5+)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
Linux (32-bit)
1.1
1.2Never BuiltWhy not?
1.1 Available View build log
Linux (64-bit)
1.2 Available View build log
1.1 Available View build log
 
License
Simplified BSD
Dependencies
Lastest release
version 1.2 on Jan 9th, 2014

Query a daterange on objects with a daterange.

Example: You want all events within a date range of next two weeks, neither if the event has started one week ago nor ends one week later - or both.

Consider objects with a daterange start and end. Use this addon to query all obejcts inside a query-start and query-end range, where either or both of objects start and end match the query range.

This index is possibly the fastest way to solve the problem, it solves it as an zope index and works direct with the catalogs fast IISets (or IFSets). Its much faster than formerly used classical catalog-query post-processing.

There are two types of indexes available:

  • Products.ZCatalog (Zope 2) compatible
  • zope.catalog (Zope (3) framework) compatible

The index acts as an proxy for a more complex query on two indexes (DateIndex on ZCatalog or FieldIndex on zope.catalog). It utilize the other indexes and does not store any index-data itself.

To illustrate this a query example on ZCatalog):

>>> result = zcatalog.search({'myindex': {'start':'2000-10-01 00:00',
...                                       'end':'2010-10-31 23:59'} })

or a query example on zope.catalog:

>>> query = catalog.apply({'myindex': (datetime(2000, 10, 01, 00, 00'),
...                                    datetime(2010, 10, 31, 23, 59'))})

This will find objects (consider start is always before end date):

  1. where start date is before 2000-10-01 and end date is after 2010-10-31.
  2. where start date is between 2000-10-01 and 2010-10-31.
  3. where end date is between 2000-10-01 and 2010-10-31.
  4. where both are between 2000-10-01 and 2010-10-31.

ASCII-Art of the above (q=query, e=event):

Q)    q_start|--------------------|q_end

1) e_start|---------------------------|e_end

2) e_start|---------------|e_end

3)           e_start|-----------------|e_end

4)           e_start|-----|e_end

Source Code

The sources are in a GIT DVCS with its main branches at github.

We'd be happy to see many commits, forks and pull-requests to make DateRangeInRangeIndex even better.

Contributors

History

1.2
  • added zope.catalog compatible index. [jensens, 2012-04-12]
1.1
  • eggification and release at pypi [jensens, 2011-03-08]
1.0
  • final release as Zope Product [jensens, 2007-08-29]

License

Copyright (c) 2007-2012, BlueDynamics Alliance, Austria All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the BlueDynamics Alliance nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Subscribe to package updates

Last updated Jan 9th, 2014

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.