Skip to content

Commit 6e2de6e

Browse files
author
Richard Jones
committed
applied patch [SF#236087]
1 parent 34ee765 commit 6e2de6e

File tree

9 files changed

+155
-134
lines changed

9 files changed

+155
-134
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Feature:
66
- added "imapServer.py" script (sf patch 934567)
77
- added date selection popup windows (thanks Marcus Priesch)
88
- added Xapian indexer; replaces standard indexers if Xapian is available
9+
- refactored hyperdb.rawToHyperdb, allowing a number of improvements
10+
(thanks Ralf Schlatterbeck)
911

1012

1113
2005-??-?? 0.8.4

doc/index.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ John P. Rouillard,
129129
Ollie Rutherfurd,
130130
Toby Sargeant,
131131
Giuseppe Scelsi,
132+
Ralf Schlatterbeck,
132133
Gregor Schmid,
133134
Florian Schulze,
134135
Klamer Schutte,

roundup/admin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
19-
# $Id: admin.py,v 1.95 2005-06-24 05:32:56 richard Exp $
19+
# $Id: admin.py,v 1.96 2005-07-12 01:37:49 richard Exp $
2020

2121
'''Administration commands for maintaining Roundup trackers.
2222
'''
@@ -571,7 +571,7 @@ def do_get(self, args):
571571
return 0
572572

573573

574-
def do_set(self, args, pwre = re.compile(r'{(\w+)}(.+)')):
574+
def do_set(self, args):
575575
""'''Usage: set items property=value property=value ...
576576
Set the given properties of one or more items(s).
577577
@@ -732,7 +732,7 @@ def do_display(self, args):
732732
value = cl.get(nodeid, key)
733733
print _('%(key)s: %(value)r')%locals()
734734

735-
def do_create(self, args, pwre = re.compile(r'{(\w+)}(.+)')):
735+
def do_create(self, args):
736736
""'''Usage: create classname property=value ...
737737
Create a new entry of a given class.
738738

roundup/backends/back_anydbm.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.187 2005-04-28 00:21:42 richard Exp $
18+
#$Id: back_anydbm.py,v 1.188 2005-07-12 01:37:49 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -1592,7 +1592,6 @@ def filter(self, search_matches, filterspec, sort=(None,None),
15921592
INTERVAL = 'spec:interval'
15931593
OTHER = 'spec:other'
15941594

1595-
timezone = self.db.getUserTimezone()
15961595
for k, v in filterspec.items():
15971596
propclass = props[k]
15981597
if isinstance(propclass, hyperdb.Link):
@@ -1623,7 +1622,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16231622
l.append((STRING, k, re.compile(v, re.I)))
16241623
elif isinstance(propclass, hyperdb.Date):
16251624
try:
1626-
date_rng = date.Range(v, date.Date, offset=timezone)
1625+
date_rng = propclass.range_from_raw (v, self.db)
16271626
l.append((DATE, k, date_rng))
16281627
except ValueError:
16291628
# If range creation fails - ignore that search parameter

roundup/backends/back_metakit.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.96 2005-06-24 06:38:14 richard Exp $
1+
# $Id: back_metakit.py,v 1.97 2005-07-12 01:37:49 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -1209,8 +1209,6 @@ def filter(self, search_matches, filterspec, sort=(None,None),
12091209
if __debug__:
12101210
start_t = time.time()
12111211

1212-
timezone = self.db.getUserTimezone()
1213-
12141212
where = {'_isdel':0}
12151213
wherehigh = {}
12161214
mlcriteria = {}
@@ -1277,7 +1275,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
12771275
elif isinstance(prop, hyperdb.Date):
12781276
try:
12791277
# Try to filter on range of dates
1280-
date_rng = Range(value, date.Date, offset=timezone)
1278+
date_rng = prop.range_from_raw (value, self.db)
12811279
if date_rng.from_value:
12821280
t = date_rng.from_value.get_tuple()
12831281
where[propname] = int(calendar.timegm(t))

roundup/backends/back_mysql.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#$Id: back_mysql.py,v 1.58 2005-05-02 05:48:59 richard Exp $
1+
#$Id: back_mysql.py,v 1.59 2005-07-12 01:37:49 richard Exp $
22
#
33
# Copyright (c) 2003 Martynas Sklyzmantas, Andrey Lebedev <[email protected]>
44
#
@@ -521,8 +521,6 @@ def filter(self, search_matches, filterspec, sort=(None,None),
521521

522522
cn = self.classname
523523

524-
timezone = self.db.getUserTimezone()
525-
526524
# vars to hold the components of the SQL statement
527525
frum = ['_'+cn] # FROM clauses
528526
loj = [] # LEFT OUTER JOIN clauses
@@ -617,7 +615,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
617615
else:
618616
try:
619617
# Try to filter on range of dates
620-
date_rng = Range(v, date.Date, offset=timezone)
618+
date_rng = propclass.range_from_raw (v, self.db)
621619
if date_rng.from_value:
622620
where.append('_%s._%s >= %s'%(cn, k, a))
623621
args.append(dc(date_rng.from_value))

roundup/backends/rdbms_common.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.156 2005-06-24 06:38:14 richard Exp $
1+
# $Id: rdbms_common.py,v 1.157 2005-07-12 01:37:50 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -2061,8 +2061,6 @@ def filter(self, search_matches, filterspec, sort=(None,None),
20612061

20622062
cn = self.classname
20632063

2064-
timezone = self.db.getUserTimezone()
2065-
20662064
# vars to hold the components of the SQL statement
20672065
frum = [] # FROM clauses
20682066
loj = [] # LEFT OUTER JOIN clauses
@@ -2151,7 +2149,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
21512149
else:
21522150
try:
21532151
# Try to filter on range of dates
2154-
date_rng = Range(v, date.Date, offset=timezone)
2152+
date_rng = propclass.range_from_raw (v, self.db)
21552153
if date_rng.from_value:
21562154
where.append('_%s._%s >= %s'%(cn, k, a))
21572155
args.append(dc(date_rng.from_value))

roundup/cgi/templating.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,8 @@ def __init__(self, client, classname, nodeid, prop, name, value,
13971397
isinstance(self._value, unicode)):
13981398
self._value.setTranslator(self._client.translator)
13991399
self._offset = offset
1400+
if self._offset is None :
1401+
self._offset = self._prop.offset (self._db)
14001402

14011403
def plain(self):
14021404
''' Render a "plain" representation of the property
@@ -1481,8 +1483,11 @@ def field(self, size=30, default=None, format=_marker):
14811483
else:
14821484
value = date.Date(raw_value).pretty(format)
14831485
else:
1484-
tz = self._db.getUserTimezone()
1485-
value = raw_value.local(tz)
1486+
if self._offset is None :
1487+
offset = self._db.getUserTimezone()
1488+
else :
1489+
offset = self._offset
1490+
value = raw_value.local(offset)
14861491
if format is not self._marker:
14871492
value = value.pretty(format)
14881493

0 commit comments

Comments
 (0)