summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1b80c99)
raw | patch | inline | side by side (parent: 1b80c99)
author | kedder <kedder@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 10 Mar 2003 20:24:30 +0000 (20:24 +0000) | ||
committer | kedder <kedder@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Mon, 10 Mar 2003 20:24:30 +0000 (20:24 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1584 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/backends/back_metakit.py | patch | blob | history |
index d8adbee4198c346131b50994d5a26224c339c28b..fec52eb95579bc27887062c38f31dc3bc0b8e21e 100755 (executable)
+# $Id: back_metakit.py,v 1.41 2003-03-10 20:24:30 kedder Exp $
'''
Metakit backend for Roundup, originally by Gordon McMillan.
import re, marshal, os, sys, weakref, time, calendar
from roundup import indexer
import locking
+from roundup.date import Range
_dbs = {}
# filterspec is a dict {propname:value}
# sort and group are (dir, prop) where dir is '+', '-' or None
# and prop is a prop name or None
+
+ timezone = self.db.getUserTimezone()
+
where = {'_isdel':0}
+ wherehigh = {}
mlcriteria = {}
regexes = {}
orcriteria = {}
bv = value
where[propname] = bv
elif isinstance(prop, hyperdb.Date):
- t = date.Date(value).get_tuple()
- where[propname] = int(calendar.timegm(t))
+ try:
+ # Try to filter on range of dates
+ date_rng = Range(value, date.Date, offset=timezone)
+ if date_rng.from_value:
+ t = date_rng.from_value.get_tuple()
+ where[propname] = int(calendar.timegm(t))
+ if date_rng.to_value:
+ t = date_rng.to_value.get_tuple()
+ wherehigh[propname] = int(calendar.timegm(t))
+ else:
+ wherehigh[propname] = None
+ except ValueError:
+ # If range creation fails - ignore that search parameter
+ pass
elif isinstance(prop, hyperdb.Interval):
where[propname] = str(date.Interval(value))
elif isinstance(prop, hyperdb.Number):
v = self.getview()
#print "filter start at %s" % time.time()
if where:
- v = v.select(where)
+ where_higherbound = where.copy()
+ where_higherbound.update(wherehigh)
+ v = v.select(where, where_higherbound)
#print "filter where at %s" % time.time()
if mlcriteria: