From 75853c3a08bd8dc4d5e04f94cb5e72a4d4df121c Mon Sep 17 00:00:00 2001 From: richard Date: Mon, 7 Oct 2002 00:52:51 +0000 Subject: [PATCH] - fixed filter() with no sort/group (sf bug 618614) - fixed register with no session (sf bug 618611) - fixed log / pid file path handling in roundup-server (sf bug 617981) - fixed old gadfly compatibiltiy problem, for sure this time (sf bug 612873) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1322 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 4 ++++ MANIFEST.in | 1 + doc/Makefile | 3 +-- roundup/backends/__init__.py | 8 ++++++-- roundup/backends/back_anydbm.py | 6 +++--- roundup/backends/back_gadfly.py | 5 +++-- roundup/backends/back_metakit.py | 4 ++-- roundup/backends/rdbms_common.py | 5 +++-- roundup/cgi/client.py | 6 +++--- roundup/hyperdb.py | 17 +++++++++++++---- roundup/mailgw.py | 5 ++--- roundup/scripts/roundup_server.py | 17 ++++++++++++++--- 12 files changed, 55 insertions(+), 26 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 422fb2d..c8ae24f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -6,6 +6,10 @@ are given with the most recent entry first. - metakit cleanups - nicer "navigation" style in index views - handle missing Link values in anydbm backend set() operation +- fixed filter() with no sort/group (sf bug 618614) +- fixed register with no session (sf bug 618611) +- fixed log / pid file path handling in roundup-server (sf bug 617981) +- fixed old gadfly compatibiltiy problem, for sure this time (sf bug 612873) 2002-10-02 0.5.0 diff --git a/MANIFEST.in b/MANIFEST.in index b7c6a32..29d70e3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,4 +9,5 @@ recursive-exclude roundup *.pyc *.pyo .cvsignore recursive-exclude frontends *.pyc *.pyo .cvsignore include run_tests *.txt exclude BUILD.txt I18N_PROGRESS.txt TODO.txt +exclude doc/security.txt doc/templating.txt diff --git a/doc/Makefile b/doc/Makefile index 987dfe7..dcfb826 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -3,8 +3,7 @@ STXTOHTML = -c "from docutils.core import publish;publish(writer_name='html')" SOURCE = announcement.txt customizing.txt developers.txt FAQ.txt features.txt \ glossary.txt implementation.txt index.txt design.txt \ - installation.txt security.txt upgrading.txt user_guide.txt \ - maintenance.txt + installation.txt upgrading.txt user_guide.txt maintenance.txt COMPILED := $(SOURCE:.txt=.html) diff --git a/roundup/backends/__init__.py b/roundup/backends/__init__.py index 8a6b107..047c294 100644 --- a/roundup/backends/__init__.py +++ b/roundup/backends/__init__.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: __init__.py,v 1.19 2002-10-03 06:56:29 richard Exp $ +# $Id: __init__.py,v 1.20 2002-10-07 00:52:51 richard Exp $ ''' Container for the hyperdb storage backend implementations. @@ -46,7 +46,11 @@ try: import gadfly import gadfly.client except ImportError, message: - if str(message) != 'No module named gadfly': raise + if str(message) == 'No module named client': + # don't keep the old gadfly around + del gadfly + elif str(message) != 'No module named gadfly': + raise else: import back_gadfly gadfly = back_gadfly diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 19a94d7..d99094f 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.87 2002-10-04 06:30:30 richard Exp $ +#$Id: back_anydbm.py,v 1.88 2002-10-07 00:52:51 richard Exp $ ''' This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python @@ -1531,8 +1531,8 @@ class Class(hyperdb.Class): l.sort() return l - def filter(self, search_matches, filterspec, sort, group, - num_re = re.compile('^\d+$')): + def filter(self, search_matches, filterspec, sort=(None,None), + group=(None,None), num_re = re.compile('^\d+$')): ''' Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec. diff --git a/roundup/backends/back_gadfly.py b/roundup/backends/back_gadfly.py index f81dd04..62dfee2 100644 --- a/roundup/backends/back_gadfly.py +++ b/roundup/backends/back_gadfly.py @@ -1,4 +1,4 @@ -# $Id: back_gadfly.py,v 1.28 2002-10-03 06:56:29 richard Exp $ +# $Id: back_gadfly.py,v 1.29 2002-10-07 00:52:51 richard Exp $ ''' Gadlfy relational database hypderb backend. About Gadfly @@ -137,7 +137,8 @@ class Database(rdbms_common.Database): return res class GadflyClass: - def filter(self, search_matches, filterspec, sort, group): + def filter(self, search_matches, filterspec, sort=(None,None), + group=(None,None)): ''' Gadfly doesn't have a LIKE predicate :( ''' cn = self.classname diff --git a/roundup/backends/back_metakit.py b/roundup/backends/back_metakit.py index 1cdcda3..c8e220d 100755 --- a/roundup/backends/back_metakit.py +++ b/roundup/backends/back_metakit.py @@ -738,10 +738,10 @@ class Class: view = self.__getview() self.db.commit() # ---- end of ping's spec - def filter(self, search_matches, filterspec, sort, group): + def filter(self, search_matches, filterspec, sort=(None,None), + group=(None,None)): # search_matches is None or a set (dict of {nodeid: {propname:[nodeid,...]}}) # filterspec is a dict {propname:value} - # sort and group are lists of propnames # sort and group are (dir, prop) where dir is '+', '-' or None # and prop is a prop name or None diff --git a/roundup/backends/rdbms_common.py b/roundup/backends/rdbms_common.py index ced7cca..8839273 100644 --- a/roundup/backends/rdbms_common.py +++ b/roundup/backends/rdbms_common.py @@ -1,4 +1,4 @@ -# $Id: rdbms_common.py,v 1.20 2002-10-03 06:56:29 richard Exp $ +# $Id: rdbms_common.py,v 1.21 2002-10-07 00:52:51 richard Exp $ ''' Relational database (SQL) backend common code. Basics: @@ -1708,7 +1708,8 @@ class Class(hyperdb.Class): ''' return self.db.getnodeids(self.classname, retired=0) - def filter(self, search_matches, filterspec, sort, group): + def filter(self, search_matches, filterspec, sort=(None,None), + group=(None,None)): ''' Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the sort spec diff --git a/roundup/cgi/client.py b/roundup/cgi/client.py index df85b0c..46167eb 100644 --- a/roundup/cgi/client.py +++ b/roundup/cgi/client.py @@ -1,4 +1,4 @@ -# $Id: client.py,v 1.49 2002-10-03 06:56:29 richard Exp $ +# $Id: client.py,v 1.50 2002-10-07 00:52:51 richard Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -603,8 +603,8 @@ class Client: # re-open the database for real, using the user self.opendb(self.user) - # update the user's session - if self.session: + # if we have a session, update it + if hasattr(self, 'session'): self.db.sessions.set(self.session, user=self.user, last_use=time.time()) else: diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py index 221377c..56f7ab0 100644 --- a/roundup/hyperdb.py +++ b/roundup/hyperdb.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: hyperdb.py,v 1.83 2002-10-03 06:56:29 richard Exp $ +# $Id: hyperdb.py,v 1.84 2002-10-07 00:52:51 richard Exp $ """ Hyperdatabase implementation, especially field types. @@ -512,11 +512,20 @@ class Class: """ raise NotImplementedError - def filter(self, search_matches, filterspec, sort, group, - num_re = re.compile('^\d+$')): + def filter(self, search_matches, filterspec, sort=(None,None), + group=(None,None)): ''' Return a list of the ids of the active nodes in this class that match the 'filter' spec, sorted by the group spec and then the - sort spec + sort spec. + + "filterspec" is {propname: value(s)} + "sort" and "group" are (dir, prop) where dir is '+', '-' or None + and prop is a prop name or None + "search_matches" is {nodeid: marker} + + The filter must match all properties specificed - but if the + property value to match is a list, any one of the values in the + list may match for that property to match. ''' raise NotImplementedError diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 501da00..9bb0229 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.94 2002-10-03 06:56:29 richard Exp $ +$Id: mailgw.py,v 1.95 2002-10-07 00:52:51 richard Exp $ ''' import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri @@ -859,8 +859,7 @@ def uidFromAddress(db, address, create=1): # try the user alternate addresses if possible props = db.user.getprops() if props.has_key('alternate_addresses'): - users = db.user.filter(None, {'alternate_addresses': address}, - [], []) + users = db.user.filter(None, {'alternate_addresses': address}) user = extractUserFromList(db.user, users) if user is not None: return user diff --git a/roundup/scripts/roundup_server.py b/roundup/scripts/roundup_server.py index 72d7d38..86f8444 100644 --- a/roundup/scripts/roundup_server.py +++ b/roundup/scripts/roundup_server.py @@ -16,7 +16,7 @@ # """ HTTP Server that serves roundup. -$Id: roundup_server.py,v 1.12 2002-09-23 06:48:35 richard Exp $ +$Id: roundup_server.py,v 1.13 2002-10-07 00:52:51 richard Exp $ """ # python version check @@ -225,7 +225,18 @@ def daemonize(pidfile): os.dup2(devnull, 1) os.dup2(devnull, 2) +def abspath(path): + ''' Make the given path an absolute path. + + Code from Zope-Coders posting of 2002-10-06 by GvR. + ''' + if not os.path.isabs(path): + path = os.path.join(os.getcwd(), path) + return os.path.normpath(path) + def run(): + ''' Script entry point - handle args and figure out what to to. + ''' hostname = '' port = 8080 pidfile = None @@ -242,8 +253,8 @@ def run(): if opt == '-n': hostname = arg elif opt == '-p': port = int(arg) elif opt == '-u': user = arg - elif opt == '-d': pidfile = arg - elif opt == '-l': logfile = arg + elif opt == '-d': pidfile = abspath(arg) + elif opt == '-l': logfile = abspath(arg) elif opt == '-h': usage() if hasattr(os, 'getuid'): -- 2.30.2