summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e3e87b1)
raw | patch | inline | side by side (parent: e3e87b1)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 12 Aug 2001 06:32:36 +0000 (06:32 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Sun, 12 Aug 2001 06:32:36 +0000 (06:32 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@231 57a73879-2fb5-44c3-a270-3262357dd7e2
diff --git a/README.txt b/README.txt
index ac9ee384ebc95338eb5cf992e8647ea28d1a4f40..a15d3f9e2622040c7038054e9c623f6194333b99 100644 (file)
--- a/README.txt
+++ b/README.txt
. more unit tests
. more back-ends
. better error handling (nicer messages for users)
- . possibly revert the entire damn thing to 1.5.2 ... :(
hyperdb:
. transaction support
. more efficient reverse lookups
diff --git a/roundup-admin b/roundup-admin
index a1be5c39a190cb073273bc43d2b0ec0092be2edd..13b2047eb8c151fd47014e3427a3f4e2f57ed81f 100755 (executable)
--- a/roundup-admin
+++ b/roundup-admin
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: roundup-admin,v 1.15 2001-08-07 00:24:42 richard Exp $
+# $Id: roundup-admin,v 1.16 2001-08-12 06:32:36 richard Exp $
import sys
if int(sys.version[0]) < 2:
properties = cl.getprops()
for key, value in props.items():
type = properties[key]
- if type.isStringType:
+ if isinstance(type, hyperdb.String):
continue
- elif type.isDateType:
+ elif isinstance(type, hyperdb.Date):
props[key] = date.Date(value)
- elif type.isIntervalType:
+ elif isinstance(type, hyperdb.Interval):
props[key] = date.Interval(value)
- elif type.isLinkType:
+ elif isinstance(type, hyperdb.Link):
props[key] = value
- elif type.isMultilinkType:
+ elif isinstance(type, hyperdb.Multilink):
props[key] = value.split(',')
apply(cl.set, (nodeid, ), props)
return 0
for prop in args[1:]:
key, value = prop.split('=')
type = properties[key]
- if type.isStringType:
+ if isinstance(type, hyperdb.String):
props[key] = value
- elif type.isDateType:
+ elif isinstance(type, hyperdb.Date):
props[key] = date.Date(value)
- elif type.isIntervalType:
+ elif isinstance(type, hyperdb.Interval):
props[key] = date.Interval(value)
- elif type.isLinkType:
+ elif isinstance(type, hyperdb.Link):
props[key] = value
- elif type.isMultilinkType:
+ elif isinstance(type, hyperdb.Multilink):
props[key] = value.split(',')
print apply(cl.create, (), props)
return 0
# for nodeid in cl.list():
# node = {}
# for name, type in properties:
-# if type.isMultilinkType:
+# isinstance( if type, hyperdb.Multilink):
# node[name] = cl.get(nodeid, name, [])
# else:
# node[name] = cl.get(nodeid, name, None)
#
# $Log: not supported by cvs2svn $
+# Revision 1.15 2001/08/07 00:24:42 richard
+# stupid typo
+#
# Revision 1.14 2001/08/07 00:15:51 richard
# Added the copyright/license notice to (nearly) all files at request of
# Bizar Software.
index 61760787d2acc1cbd34b2074dc2e0e565af15852..36fb3df7c33e6e11394c09d5c6bd75464c482563 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_anydbm.py,v 1.6 2001-08-07 00:24:42 richard Exp $
+#$Id: back_anydbm.py,v 1.7 2001-08-12 06:32:36 richard Exp $
import anydbm, os, marshal
from roundup import hyperdb, date
# convert the instance data to builtin types
properties = self.classes[classname].properties
for key in properties.keys():
- if properties[key].isDateType:
+ if isinstance(properties[key], hyperdb.Date):
node[key] = node[key].get_tuple()
- elif properties[key].isIntervalType:
+ elif isinstance(properties[key], hyperdb.Interval):
node[key] = node[key].get_tuple()
# now save the marshalled data
properties = self.classes[classname].properties
for key in properties.keys():
if key == self.RETIRED_FLAG: continue
- if properties[key].isDateType:
+ if isinstance(properties[key], hyperdb.Date):
res[key] = date.Date(res[key])
- elif properties[key].isIntervalType:
+ elif isinstance(properties[key], hyperdb.Interval):
res[key] = date.Interval(res[key])
if not cldb: db.close()
#
#$Log: not supported by cvs2svn $
+#Revision 1.6 2001/08/07 00:24:42 richard
+#stupid typo
+#
#Revision 1.5 2001/08/07 00:15:51 richard
#Added the copyright/license notice to (nearly) all files at request of
#Bizar Software.
index b5e25a249a95d88a5b3e91238743871abe9ab604..4562d29900f113a21bd5b03dd7f3dab511da570d 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_bsddb.py,v 1.8 2001-08-07 00:24:42 richard Exp $
+#$Id: back_bsddb.py,v 1.9 2001-08-12 06:32:36 richard Exp $
import bsddb, os, marshal
from roundup import hyperdb, date
# convert the instance data to builtin types
properties = self.classes[classname].properties
for key in properties.keys():
- if properties[key].isDateType:
+ if isinstance(properties[key], hyperdb.Date):
node[key] = node[key].get_tuple()
- elif properties[key].isIntervalType:
+ elif isinstance(properties[key], hyperdb.Interval):
node[key] = node[key].get_tuple()
# now save the marshalled data
# convert the marshalled data to instances
properties = self.classes[classname].properties
for key in properties.keys():
- if properties[key].isDateType:
+ if isinstance(properties[key], hyperdb.Date):
res[key] = date.Date(res[key])
- elif properties[key].isIntervalType:
+ elif isinstance(properties[key], hyperdb.Interval):
res[key] = date.Interval(res[key])
if not cldb: db.close()
#
#$Log: not supported by cvs2svn $
+#Revision 1.8 2001/08/07 00:24:42 richard
+#stupid typo
+#
#Revision 1.7 2001/08/07 00:15:51 richard
#Added the copyright/license notice to (nearly) all files at request of
#Bizar Software.
index 46b693c1a1a5a1b1e6fa29e2db7690f884524b2a..8c402e5421041330389eb68e501759f61c45a356 100644 (file)
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-#$Id: back_bsddb3.py,v 1.6 2001-08-07 00:24:42 richard Exp $
+#$Id: back_bsddb3.py,v 1.7 2001-08-12 06:32:36 richard Exp $
import bsddb3, os, marshal
from roundup import hyperdb, date
# convert the instance data to builtin types
properties = self.classes[classname].properties
for key in properties.keys():
- if properties[key].isDateType:
+ if isinstance(properties[key], hyperdb.Date):
node[key] = node[key].get_tuple()
- elif properties[key].isIntervalType:
+ elif isinstance(properties[key], hyperdb.Interval):
node[key] = node[key].get_tuple()
# now save the marshalled data
# convert the marshalled data to instances
properties = self.classes[classname].properties
for key in properties.keys():
- if properties[key].isDateType:
+ if isinstance(properties[key], hyperdb.Date):
res[key] = date.Date(res[key])
- elif properties[key].isIntervalType:
+ elif isinstance(properties[key], hyperdb.Interval):
res[key] = date.Interval(res[key])
if not cldb: db.close()
#
#$Log: not supported by cvs2svn $
+#Revision 1.6 2001/08/07 00:24:42 richard
+#stupid typo
+#
#Revision 1.5 2001/08/07 00:15:51 richard
#Added the copyright/license notice to (nearly) all files at request of
#Bizar Software.
diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py
index c4698826f5e057962d514ba7530c23d206f9266b..4f43ab3707e9ef642cd4d4cd547478ec749a7322 100644 (file)
--- a/roundup/cgi_client.py
+++ b/roundup/cgi_client.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: cgi_client.py,v 1.19 2001-08-07 00:24:42 richard Exp $
+# $Id: cgi_client.py,v 1.20 2001-08-12 06:32:36 richard Exp $
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
if key[0] == ':': continue
prop = props[key]
value = self.form[key]
- if prop.isLinkType or prop.isMultilinkType:
+ if isinstance(prop.isLinkType or prop, hyperdb.Multilink):
if type(value) == type([]):
value = [arg.value for arg in value]
else:
if not cl.properties.has_key(key):
continue
proptype = cl.properties[key]
- if proptype.isStringType:
+ if isinstance(proptype, hyperdb.String):
value = str(self.form[key].value).strip()
- elif proptype.isDateType:
+ elif isinstance(proptype, hyperdb.Date):
value = date.Date(str(self.form[key].value))
- elif proptype.isIntervalType:
+ elif isinstance(proptype, hyperdb.Interval):
value = date.Interval(str(self.form[key].value))
- elif proptype.isLinkType:
+ elif isinstance(proptype, hyperdb.Link):
value = str(self.form[key].value).strip()
# handle key values
link = cl.properties[key].classname
except:
raise ValueError, 'property "%s": %s not a %s'%(
key, value, link)
- elif proptype.isMultilinkType:
+ elif isinstance(proptype, hyperdb.Multilink):
value = self.form[key]
if type(value) != type([]):
value = [i.strip() for i in str(value.value).split(',')]
if not cl.properties.has_key(key):
continue
proptype = cl.properties[key]
- if proptype.isStringType:
+ if isinstance(proptype, hyperdb.String):
value = self.form[key].value.strip()
- elif proptype.isDateType:
+ elif isinstance(proptype, hyperdb.Date):
value = date.Date(self.form[key].value.strip())
- elif proptype.isIntervalType:
+ elif isinstance(proptype, hyperdb.Interval):
value = date.Interval(self.form[key].value.strip())
- elif proptype.isLinkType:
+ elif isinstance(proptype, hyperdb.Link):
value = self.form[key].value.strip()
# handle key values
link = cl.properties[key].classname
except:
raise ValueError, 'property "%s": %s not a %s'%(
key, value, link)
- elif proptype.isMultilinkType:
+ elif isinstance(proptype, hyperdb.Multilink):
value = self.form[key]
if type(value) != type([]):
value = [i.strip() for i in value.value.split(',')]
m.append('\n-------')
first = 0
value = cl.get(nid, name, None)
- if prop.isLinkType:
+ if isinstance(prop, hyperdb.Link):
link = self.db.classes[prop.classname]
key = link.labelprop(default_to_id=1)
if value is not None and key:
value = link.get(value, key)
else:
value = '-'
- elif prop.isMultilinkType:
+ elif isinstance(prop, hyperdb.Multilink):
if value is None: value = []
l = []
link = self.db.classes[prop.classname]
#
# $Log: not supported by cvs2svn $
+# Revision 1.19 2001/08/07 00:24:42 richard
+# stupid typo
+#
# Revision 1.18 2001/08/07 00:15:51 richard
# Added the copyright/license notice to (nearly) all files at request of
# Bizar Software.
index 68562ce5586f617748597184d07b93a0fc161c79..50ac79fe0a8ac5299e00ff5b2ee413347137d8e5 100644 (file)
--- a/roundup/htmltemplate.py
+++ b/roundup/htmltemplate.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: htmltemplate.py,v 1.18 2001-08-07 00:24:42 richard Exp $
+# $Id: htmltemplate.py,v 1.19 2001-08-12 06:32:36 richard Exp $
import os, re, StringIO, urllib, cgi, errno
value = self.cl.get(self.nodeid, property)
else:
# TODO: pull the value from the form
- if propclass.isMultilinkType: value = []
+ if isinstance(propclass, hyperdb.Multilink): value = []
else: value = ''
- if propclass.isStringType:
+ if isinstance(propclass, hyperdb.String):
if value is None: value = ''
else: value = str(value)
- elif propclass.isDateType:
+ elif isinstance(propclass, hyperdb.Date):
value = str(value)
- elif propclass.isIntervalType:
+ elif isinstance(propclass, hyperdb.Interval):
value = str(value)
- elif propclass.isLinkType:
+ elif isinstance(propclass, hyperdb.Link):
linkcl = self.db.classes[propclass.classname]
k = linkcl.labelprop()
if value: value = str(linkcl.get(value, k))
else: value = '[unselected]'
- elif propclass.isMultilinkType:
+ elif isinstance(propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
k = linkcl.labelprop()
value = ', '.join([linkcl.get(i, k) for i in value])
# TODO: remove this from the code ... it's only here for
# handling schema changes, and they should be handled outside
# of this code...
- if propclass.isMultilinkType and value is None:
+ if isinstance(propclass, hyperdb.Multilink) and value is None:
value = []
elif self.filterspec is not None:
- if propclass.isMultilinkType:
+ if isinstance(propclass, hyperdb.Multilink):
value = self.filterspec.get(property, [])
else:
value = self.filterspec.get(property, '')
else:
# TODO: pull the value from the form
- if propclass.isMultilinkType: value = []
+ if isinstance(propclass, hyperdb.Multilink): value = []
else: value = ''
- if (propclass.isStringType or propclass.isDateType or
+ if isinstance((propclass.isStringType or propclass, hyperdb.Date) or
propclass.isIntervalType):
size = size or 30
if value is None:
value = cgi.escape(value)
value = '"'.join(value.split('"'))
s = '<input name="%s" value="%s" size="%s">'%(property, value, size)
- elif propclass.isLinkType:
+ elif isinstance(propclass, hyperdb.Link):
linkcl = self.db.classes[propclass.classname]
l = ['<select name="%s">'%property]
k = linkcl.labelprop()
l.append('<option %svalue="%s">%s</option>'%(s, optionid, lab))
l.append('</select>')
s = '\n'.join(l)
- elif propclass.isMultilinkType:
+ elif isinstance(propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
list = linkcl.list()
height = height or min(len(list), 7)
value = self.cl.get(self.nodeid, property)
else:
# TODO: pull the value from the form
- if propclass.isMultilinkType: value = []
+ if isinstance(propclass, hyperdb.Multilink): value = []
else: value = None
- if propclass.isLinkType:
+ if isinstance(propclass, hyperdb.Link):
linkcl = self.db.classes[propclass.classname]
l = ['<select name="%s">'%property]
k = linkcl.labelprop()
l.append('<option %svalue="%s">%s</option>'%(s, optionid, option))
l.append('</select>')
return '\n'.join(l)
- if propclass.isMultilinkType:
+ if isinstance(propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
list = linkcl.list()
height = height or min(len(list), 7)
if self.nodeid:
value = self.cl.get(self.nodeid, property)
else:
- if propclass.isMultilinkType: value = []
+ if isinstance(propclass, hyperdb.Multilink): value = []
else: value = ''
- if propclass.isLinkType:
+ if isinstance(propclass, hyperdb.Link):
if value is None:
return '[not assigned]'
linkcl = self.db.classes[propclass.classname]
k = linkcl.labelprop()
linkvalue = linkcl.get(value, k)
return '<a href="%s%s">%s</a>'%(linkcl, value, linkvalue)
- if propclass.isMultilinkType:
+ if isinstance(propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
k = linkcl.labelprop()
l = []
return '[Count: not called from item]'
propclass = self.properties[property]
value = self.cl.get(self.nodeid, property)
- if propclass.isMultilinkType:
+ if isinstance(propclass, hyperdb.Multilink):
return str(len(value))
return '[Count: not a Multilink]'
if not self.nodeid and self.form is None:
return '[Reldate: not called from item]'
propclass = self.properties[property]
- if not propclass.isDateType:
+ if isinstance(not propclass, hyperdb.Date):
return '[Reldate: not a Date]'
if self.nodeid:
value = self.cl.get(self.nodeid, property)
return '[Download: not called from item]'
propclass = self.properties[property]
value = self.cl.get(self.nodeid, property)
- if propclass.isLinkType:
+ if isinstance(propclass, hyperdb.Link):
linkcl = self.db.classes[propclass.classname]
linkvalue = linkcl.get(value, k)
return '<a href="%s%s">%s</a>'%(linkcl, value, linkvalue)
- if propclass.isMultilinkType:
+ if isinstance(propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
l = []
for value in value:
value = self.filterspec.get(property, [])
else:
value = []
- if propclass.isLinkType or propclass.isMultilinkType:
+ if isinstance(propclass.isLinkType or propclass, hyperdb.Multilink):
linkcl = self.db.classes[propclass.classname]
l = []
k = linkcl.labelprop()
'''
def __call__(self, property, **args):
propclass = self.properties[property]
- if not propclass.isMultilinkType:
+ if isinstance(not propclass, hyperdb.Multilink):
return '[List: not a Multilink]'
fp = StringIO.StringIO()
args['show_display_form'] = 0
r'((<property\s+name="(?P<name>[^>]+)">(?P<text>.+?)</property>)|'
r'(?P<display><display\s+call="(?P<command>[^"]+)">))', re.I|re.S)):
return replace.sub(self, text)
-
+
def __call__(self, m, filter=None, columns=None, sort=None, group=None):
if m.group('name'):
if m.group('name') in self.props:
l = []
for name in group_names:
prop = properties[name]
- if prop.isLinkType:
+ if isinstance(prop, hyperdb.Link):
group_cl = db.classes[prop.classname]
key = group_cl.getkey()
value = cl.get(nodeid, name)
l.append('[unselected %s]'%prop.classname)
else:
l.append(group_cl.get(cl.get(nodeid, name), key))
- elif prop.isMultilinkType:
+ elif isinstance(prop, hyperdb.Multilink):
group_cl = db.classes[prop.classname]
key = group_cl.getkey()
for value in cl.get(nodeid, name):
#
# $Log: not supported by cvs2svn $
+# Revision 1.18 2001/08/07 00:24:42 richard
+# stupid typo
+#
# Revision 1.17 2001/08/07 00:15:51 richard
# Added the copyright/license notice to (nearly) all files at request of
# Bizar Software.
diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py
index c7033b1118a6b53c44da295b1f3d2b5db3682d5c..eeb48b752669ba8e21462ed8c9edab29e029dd7b 100644 (file)
--- a/roundup/hyperdb.py
+++ b/roundup/hyperdb.py
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#
-# $Id: hyperdb.py,v 1.14 2001-08-07 00:24:42 richard Exp $
+# $Id: hyperdb.py,v 1.15 2001-08-12 06:32:36 richard Exp $
# standard python modules
import cPickle, re, string
#
# Types
#
-class BaseType:
- isStringType = 0
- isDateType = 0
- isIntervalType = 0
- isLinkType = 0
- isMultilinkType = 0
-
-class String(BaseType):
- def __init__(self):
- """An object designating a String property."""
- pass
+class String:
+ """An object designating a String property."""
def __repr__(self):
return '<%s>'%self.__class__
- isStringType = 1
-class Date(BaseType, String):
- isDateType = 1
+class Date:
+ """An object designating a Date property."""
+ def __repr__(self):
+ return '<%s>'%self.__class__
-class Interval(BaseType, String):
- isIntervalType = 1
+class Interval:
+ """An object designating an Interval property."""
+ def __repr__(self):
+ return '<%s>'%self.__class__
-class Link(BaseType):
+class Link:
+ """An object designating a Link property that links to a
+ node in a specified class."""
def __init__(self, classname):
- """An object designating a Link property that links to
- nodes in a specified class."""
self.classname = classname
def __repr__(self):
return '<%s to "%s">'%(self.__class__, self.classname)
- isLinkType = 1
-class Multilink(BaseType, Link):
+class Multilink:
"""An object designating a Multilink property that links
to nodes in a specified class.
"""
- isMultilinkType = 1
+ def __init__(self, classname):
+ self.classname = classname
+ def __repr__(self):
+ return '<%s to "%s">'%(self.__class__, self.classname)
class DatabaseError(ValueError):
pass
raise KeyError, '"%s" has no property "%s"'%(self.classname,
key)
- if prop.isLinkType:
+ if isinstance(prop, Link):
if type(value) != type(''):
raise ValueError, 'link value must be String'
-# value = str(value)
link_class = self.properties[key].classname
# if it isn't a number, it's a key
if not num_re.match(value):
self.db.addjournal(link_class, value, 'link',
(self.classname, newid, key))
- elif prop.isMultilinkType:
+ elif isinstance(prop, Multilink):
if type(value) != type([]):
raise TypeError, 'new property "%s" not a list of ids'%key
link_class = self.properties[key].classname
self.db.addjournal(link_class, id, 'link',
(self.classname, newid, key))
- elif prop.isStringType:
+ elif isinstance(prop, String):
if type(value) != type(''):
raise TypeError, 'new property "%s" not a string'%key
- elif prop.isDateType:
+ elif isinstance(prop, Date):
if not hasattr(value, 'isDate'):
raise TypeError, 'new property "%s" not a Date'% key
- elif prop.isIntervalType:
+ elif isinstance(prop, Interval):
if not hasattr(value, 'isInterval'):
raise TypeError, 'new property "%s" not an Interval'% key
for key, prop in self.properties.items():
if propvalues.has_key(key):
continue
- if prop.isMultilinkType:
+ if isinstance(prop, Multilink):
propvalues[key] = []
else:
propvalues[key] = None
"""
if propname == 'id':
return nodeid
-# nodeid = str(nodeid)
d = self.db.getnode(self.classname, nodeid)
if not d.has_key(propname) and default is not _marker:
return default
if self.db.journaltag is None:
raise DatabaseError, 'Database open read-only'
-# nodeid = str(nodeid)
node = self.db.getnode(self.classname, nodeid)
if node.has_key(self.db.RETIRED_FLAG):
raise IndexError
prop = self.properties[key]
- if prop.isLinkType:
-# value = str(value)
+ if isinstance(prop, Link):
link_class = self.properties[key].classname
# if it isn't a number, it's a key
if type(value) != type(''):
self.db.addjournal(link_class, value, 'link',
(self.classname, nodeid, key))
- elif prop.isMultilinkType:
+ elif isinstance(prop, Multilink):
if type(value) != type([]):
raise TypeError, 'new property "%s" not a list of ids'%key
link_class = self.properties[key].classname
(self.classname, nodeid, key))
l.append(id)
- elif prop.isStringType:
+ elif isinstance(prop, String):
if value is not None and type(value) != type(''):
raise TypeError, 'new property "%s" not a string'%key
- elif prop.isDateType:
+ elif isinstance(prop, Date):
if not hasattr(value, 'isDate'):
raise TypeError, 'new property "%s" not a Date'% key
- elif prop.isIntervalType:
+ elif isinstance(prop, Interval):
if not hasattr(value, 'isInterval'):
raise TypeError, 'new property "%s" not an Interval'% key
Retired nodes are not returned by the find(), list(), or lookup()
methods, and other nodes may reuse the values of their key properties.
"""
-# nodeid = str(nodeid)
if self.db.journaltag is None:
raise DatabaseError, 'Database open read-only'
node = self.db.getnode(self.classname, nodeid)
"""
propspec = propspec.items()
for propname, nodeid in propspec:
-# nodeid = str(nodeid)
# check the prop is OK
prop = self.properties[propname]
- if not prop.isLinkType and not prop.isMultilinkType:
+ if not isinstance(prop, Link) and not isinstance(prop, Multilink):
raise TypeError, "'%s' not a Link/Multilink property"%propname
if not self.db.hasnode(prop.classname, nodeid):
raise ValueError, '%s has no node %s'%(link_class, nodeid)
if node.has_key(self.db.RETIRED_FLAG):
continue
for propname, nodeid in propspec:
-# nodeid = str(nodeid)
property = node[propname]
- if prop.isLinkType and nodeid == property:
+ if isinstance(prop, Link) and nodeid == property:
l.append(id)
- elif prop.isMultilinkType and nodeid in property:
+ elif isinstance(prop, Multilink) and nodeid in property:
l.append(id)
cldb.close()
return l
"""
for propname in requirements.keys():
prop = self.properties[propname]
- if not prop.isStringType:
+ if isinstance(not prop, String):
raise TypeError, "'%s' not a String property"%propname
l = []
cldb = self.db.getclassdb(self.classname)
props = self.getprops()
for k, v in filterspec.items():
propclass = props[k]
- if propclass.isLinkType:
+ if isinstance(propclass, Link):
if type(v) is not type([]):
v = [v]
# replace key values with node ids
u.append(entry)
l.append((0, k, u))
- elif propclass.isMultilinkType:
+ elif isinstance(propclass, Multilink):
if type(v) is not type([]):
v = [v]
# replace key values with node ids
k, entry, self.properties[k].classname)
u.append(entry)
l.append((1, k, u))
- elif propclass.isStringType:
+ elif isinstance(propclass, String):
if '*' in v or '?' in v:
# simple glob searching
v = v.replace('?', '.')
propclass = properties[prop]
# String and Date values are sorted in the natural way
- if propclass.isStringType:
+ if isinstance(propclass, String):
# clean up the strings
if av and av[0] in string.uppercase:
av = an[prop] = av.lower()
if bv and bv[0] in string.uppercase:
bv = bn[prop] = bv.lower()
- if propclass.isStringType or propclass.isDateType:
+ if isinstance(propclass.isStringType or propclass, Date):
if dir == '+':
r = cmp(av, bv)
if r != 0: return r
# the "order" property on the linked nodes if it is
# present; or otherwise on the key string of the linked
# nodes; or finally on the node ids.
- elif propclass.isLinkType:
+ elif isinstance(propclass, Link):
link = db.classes[propclass.classname]
if av is None and bv is not None: return -1
if av is not None and bv is None: return 1
# Multilink properties are sorted according to how many
# links are present.
- elif propclass.isMultilinkType:
+ elif isinstance(propclass, Multilink):
if dir == '+':
r = cmp(len(av), len(bv))
if r != 0: return r
#
# $Log: not supported by cvs2svn $
+# Revision 1.14 2001/08/07 00:24:42 richard
+# stupid typo
+#
# Revision 1.13 2001/08/07 00:15:51 richard
# Added the copyright/license notice to (nearly) all files at request of
# Bizar Software.
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index a9ff1aae43919835e4cdaaaee5972bb5cef98e97..c8a31517dc74968663473ea42a7fc707a458d36d 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.12 2001-08-08 01:27:00 richard Exp $
+$Id: mailgw.py,v 1.13 2001-08-12 06:32:36 richard Exp $
'''
Subject was: "%s"
'''%(key, subject)
- if type.isStringType:
+ if isinstance(type, hyperdb.String):
props[key] = value
- elif type.isDateType:
+ elif isinstance(type, hyperdb.Date):
props[key] = date.Date(value)
- elif type.isIntervalType:
+ elif isinstance(type, hyperdb.Interval):
props[key] = date.Interval(value)
- elif type.isLinkType:
+ elif isinstance(type, hyperdb.Link):
props[key] = value
- elif type.isMultilinkType:
+ elif isinstance(type, hyperdb.Multilink):
props[key] = value.split(',')
# handle the users
#
# $Log: not supported by cvs2svn $
+# Revision 1.12 2001/08/08 01:27:00 richard
+# Added better error handling to mailgw.
+#
# Revision 1.11 2001/08/08 00:08:03 richard
# oops ;)
#