comparison roundup/hyperdb.py @ 775:4409798dfa15

Can debug to stdout now
author Richard Jones <richard@users.sourceforge.net>
date Mon, 17 Jun 2002 23:15:29 +0000
parents d913440c534f
children 6937eb92061f 982a5abb01ea
comparison
equal deleted inserted replaced
774:811475894dd9 775:4409798dfa15
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 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" 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, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: hyperdb.py,v 1.68 2002-06-11 06:52:03 richard Exp $ 18 # $Id: hyperdb.py,v 1.69 2002-06-17 23:15:29 richard Exp $
19 19
20 __doc__ = """ 20 __doc__ = """
21 Hyperdatabase implementation, especially field types. 21 Hyperdatabase implementation, especially field types.
22 """ 22 """
23 23
24 # standard python modules 24 # standard python modules
25 import re, string, weakref, os, time 25 import sys, re, string, weakref, os, time
26 26
27 # roundup modules 27 # roundup modules
28 import date, password 28 import date, password
29 29
30 # configure up the DEBUG and TRACE captures 30 # configure up the DEBUG and TRACE captures
31 class Sink: 31 class Sink:
32 def write(self, content): 32 def write(self, content):
33 pass 33 pass
34 DEBUG = os.environ.get('HYPERDBDEBUG', '') 34 DEBUG = os.environ.get('HYPERDBDEBUG', '')
35 if DEBUG and __debug__: 35 if DEBUG and __debug__:
36 DEBUG = open(DEBUG, 'a') 36 if DEBUG == 'stdout':
37 DEBUG = sys.stdout
38 else:
39 DEBUG = open(DEBUG, 'a')
37 else: 40 else:
38 DEBUG = Sink() 41 DEBUG = Sink()
39 TRACE = os.environ.get('HYPERDBTRACE', '') 42 TRACE = os.environ.get('HYPERDBTRACE', '')
40 if TRACE and __debug__: 43 if TRACE and __debug__:
41 TRACE = open(TRACE, 'w') 44 if TRACE == 'stdout':
45 TRACE = sys.stdout
46 else:
47 TRACE = open(TRACE, 'w')
42 else: 48 else:
43 TRACE = Sink() 49 TRACE = Sink()
44 def traceMark(): 50 def traceMark():
45 print >>TRACE, '**MARK', time.ctime() 51 print >>TRACE, '**MARK', time.ctime()
46 del Sink 52 del Sink
414 (self.classname, newid, key)) 420 (self.classname, newid, key))
415 421
416 elif isinstance(prop, Multilink): 422 elif isinstance(prop, Multilink):
417 if type(value) != type([]): 423 if type(value) != type([]):
418 raise TypeError, 'new property "%s" not a list of ids'%key 424 raise TypeError, 'new property "%s" not a list of ids'%key
425
426 # clean up and validate the list of links
419 link_class = self.properties[key].classname 427 link_class = self.properties[key].classname
420 l = [] 428 l = []
421 for entry in value: 429 for entry in value:
422 if type(entry) != type(''): 430 if type(entry) != type(''):
423 raise ValueError, 'link value must be String' 431 raise ValueError, 'link value must be String'
1159 cl.create(name=options[i], order=i) 1167 cl.create(name=options[i], order=i)
1160 return hyperdb.Link(name) 1168 return hyperdb.Link(name)
1161 1169
1162 # 1170 #
1163 # $Log: not supported by cvs2svn $ 1171 # $Log: not supported by cvs2svn $
1172 # Revision 1.68 2002/06/11 06:52:03 richard
1173 # . #564271 ] find() and new properties
1174 #
1164 # Revision 1.67 2002/06/11 05:02:37 richard 1175 # Revision 1.67 2002/06/11 05:02:37 richard
1165 # . #565979 ] code error in hyperdb.Class.find 1176 # . #565979 ] code error in hyperdb.Class.find
1166 # 1177 #
1167 # Revision 1.66 2002/05/25 07:16:24 rochecompaan 1178 # Revision 1.66 2002/05/25 07:16:24 rochecompaan
1168 # Merged search_indexing-branch with HEAD 1179 # Merged search_indexing-branch with HEAD

Roundup Issue Tracker: http://roundup-tracker.org/