Skip to content

Commit 574a14c

Browse files
author
Richard Jones
committed
fixed schema migration problem when Class keys were removed
fixed lookup of config in all-hell's-broken-loose cgi.Client error handler fixed metakit use of is_stopword
1 parent c0e0b7c commit 574a14c

File tree

6 files changed

+46
-10
lines changed

6 files changed

+46
-10
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Fixed:
1717
- roundup-admin import wasn't indexing message content
1818
- allow dispname to be passed to renderWith (sf bug 1424587)
1919
- rename dispname to @dispname to avoid name clashes in the future
20+
- fixed schema migration problem when Class keys were removed
2021

2122

2223
2006-02-03 1.0.1

doc/upgrading.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ and ``issue.index.html`` pages to change ``dispname`` to ``@dispname``.
4040
A side-effect of this change is that the renderWith method used in the
4141
``home.html`` page may now take a dispname argument.
4242

43+
4344
1.1 "Clear this message"
4445
------------------------
4546

roundup/backends/back_metakit.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.105 2006-02-07 04:14:02 richard Exp $
1+
# $Id: back_metakit.py,v 1.106 2006-02-09 23:53:10 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -46,7 +46,7 @@
4646
import metakit
4747
from sessions_dbm import Sessions, OneTimeKeys
4848
import re, marshal, os, sys, time, calendar, shutil
49-
from indexer_common import Indexer, is_stopword
49+
from indexer_common import Indexer
5050
import locking
5151
from roundup.date import Range
5252
from blobfiles import files_in_dir
@@ -2027,7 +2027,7 @@ def add_text(self, identifier, text, mime_type='text/plain'):
20272027
wordlist = re.findall(r'\b\w{2,25}\b', text.upper())
20282028
words = {}
20292029
for word in wordlist:
2030-
if not is_stopword(word):
2030+
if not self.is_stopword(word):
20312031
words[word] = 1
20322032
words = words.keys()
20332033

roundup/backends/rdbms_common.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
Id$
1+
#
2+
# Copyright (c) 2001 Bizar Software Pty Ltd (http://www.bizarsoftware.com.au/)
3+
# This module is free software, and you may redistribute it and/or modify
4+
# under the same terms as Python, so long as this copyright message and
5+
# disclaimer are retained in their original form.
6+
#
7+
# IN NO EVENT SHALL BIZAR SOFTWARE PTY LTD BE LIABLE TO ANY PARTY FOR
8+
# DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
9+
# OUT OF THE USE OF THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
10+
# POSSIBILITY OF SUCH DAMAGE.
11+
#
12+
# BIZAR SOFTWARE PTY LTD SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
13+
# BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14+
# FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15+
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16+
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17+
#
18+
#$Id: rdbms_common.py,v 1.167 2006-02-09 23:53:11 richard Exp $
219
''' Relational database (SQL) backend common code.
320
421
Basics:
@@ -401,7 +418,10 @@ def update_class(self, spec, old_spec, force=0):
401418
# detect key prop change for potential index change
402419
keyprop_changes = {}
403420
if new_spec[0] != old_spec[0]:
404-
keyprop_changes = {'remove': old_spec[0], 'add': new_spec[0]}
421+
if old_spec[0]:
422+
keyprop_changes['remove'] = old_spec[0]
423+
if new_spec[0]:
424+
keyprop_changes['add'] = new_spec[0]
405425

406426
# detect multilinks that have been removed, and drop their table
407427
old_has = {}

roundup/cgi/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.221 2006-02-08 05:33:11 a1s Exp $
1+
# $Id: client.py,v 1.222 2006-02-09 23:53:11 richard Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -46,8 +46,8 @@ def clean_message_callback(match, ok={'a':1,'i':1,'b':1,'br':1}):
4646
return match.group(1)
4747
return '<%s>'%match.group(2)
4848

49-
error_message = ""'''<html><head><title>Roundup error</title></head><body>
50-
<h1>An error has occurred</h1>
49+
error_message = ""'''<html><head><title>An error has occurred</title></head>
50+
<body><h1>An error has occurred</h1>
5151
<p>A problem was encountered processing your request.
5252
The tracker maintainers have been notified of the problem.</p>
5353
</body></html>'''
@@ -308,7 +308,7 @@ def inner_main(self):
308308
self.error_message.append(self._('Form Error: ') + str(e))
309309
self.write_html(self.renderContext())
310310
except:
311-
if self.db.config.WEB_DEBUG:
311+
if self.instance.config.WEB_DEBUG:
312312
self.write_html(cgitb.html(i18n=self.translator))
313313
else:
314314
self.mailer.exception_message()

test/db_test_base.py

Lines changed: 15 additions & 1 deletion
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: db_test_base.py,v 1.66 2006-02-07 04:59:05 richard Exp $
18+
# $Id: db_test_base.py,v 1.67 2006-02-09 23:53:11 richard Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint, sets
2121

@@ -1355,6 +1355,20 @@ def test_changeClassKey(self):
13551355
# confirm journal's ok
13561356
self.db.getjournal('a', aid)
13571357

1358+
def test_removeClassKey(self):
1359+
self.init_amod()
1360+
aid = self.db.a.create(name='apple')
1361+
self.assertEqual(self.db.a.lookup('apple'), aid)
1362+
self.db.commit(); self.db.close()
1363+
1364+
self.db = self.module.Database(config, 'admin')
1365+
a = self.module.Class(self.db, "a", name=String(), newstr=String())
1366+
self.db.post_init()
1367+
1368+
aid2 = self.db.a.create(name='apple', newstr='booz')
1369+
self.db.commit()
1370+
1371+
13581372
def init_amodml(self):
13591373
self.db = self.module.Database(config, 'admin')
13601374
a = self.module.Class(self.db, "a", name=String(),

0 commit comments

Comments
 (0)