comparison roundup/hyperdb.py @ 657:e0a1cc7538e9

more pychecker warnings removed
author Richard Jones <richard@users.sourceforge.net>
date Tue, 12 Mar 2002 22:52:26 +0000
parents 07422fe57db2
children bc46480e2a2b 0521ddc7bb31
comparison
equal deleted inserted replaced
656:eae9b69a0115 657:e0a1cc7538e9
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.58 2002-02-27 03:23:16 richard Exp $ 18 # $Id: hyperdb.py,v 1.59 2002-03-12 22:52:26 richard Exp $
19 19
20 __doc__ = """ 20 __doc__ = """
21 Hyperdatabase implementation, especially field types. 21 Hyperdatabase implementation, especially field types.
22 """ 22 """
23 23
33 # Types 33 # Types
34 # 34 #
35 class String: 35 class String:
36 """An object designating a String property.""" 36 """An object designating a String property."""
37 def __repr__(self): 37 def __repr__(self):
38 ' more useful for dumps '
38 return '<%s>'%self.__class__ 39 return '<%s>'%self.__class__
39 40
40 class Password: 41 class Password:
41 """An object designating a Password property.""" 42 """An object designating a Password property."""
42 def __repr__(self): 43 def __repr__(self):
44 ' more useful for dumps '
43 return '<%s>'%self.__class__ 45 return '<%s>'%self.__class__
44 46
45 class Date: 47 class Date:
46 """An object designating a Date property.""" 48 """An object designating a Date property."""
47 def __repr__(self): 49 def __repr__(self):
50 ' more useful for dumps '
48 return '<%s>'%self.__class__ 51 return '<%s>'%self.__class__
49 52
50 class Interval: 53 class Interval:
51 """An object designating an Interval property.""" 54 """An object designating an Interval property."""
52 def __repr__(self): 55 def __repr__(self):
56 ' more useful for dumps '
53 return '<%s>'%self.__class__ 57 return '<%s>'%self.__class__
54 58
55 class Link: 59 class Link:
56 """An object designating a Link property that links to a 60 """An object designating a Link property that links to a
57 node in a specified class.""" 61 node in a specified class."""
58 def __init__(self, classname, do_journal='no'): 62 def __init__(self, classname, do_journal='no'):
63 ''' Default is to not journal link and unlink events
64 '''
59 self.classname = classname 65 self.classname = classname
60 self.do_journal = do_journal == 'yes' 66 self.do_journal = do_journal == 'yes'
61 def __repr__(self): 67 def __repr__(self):
68 ' more useful for dumps '
62 return '<%s to "%s">'%(self.__class__, self.classname) 69 return '<%s to "%s">'%(self.__class__, self.classname)
63 70
64 class Multilink: 71 class Multilink:
65 """An object designating a Multilink property that links 72 """An object designating a Multilink property that links
66 to nodes in a specified class. 73 to nodes in a specified class.
69 76
70 "do_journal" indicates whether the linked-to nodes should have 77 "do_journal" indicates whether the linked-to nodes should have
71 'link' and 'unlink' events placed in their journal 78 'link' and 'unlink' events placed in their journal
72 """ 79 """
73 def __init__(self, classname, do_journal='no'): 80 def __init__(self, classname, do_journal='no'):
81 ''' Default is to not journal link and unlink events
82 '''
74 self.classname = classname 83 self.classname = classname
75 self.do_journal = do_journal == 'yes' 84 self.do_journal = do_journal == 'yes'
76 def __repr__(self): 85 def __repr__(self):
86 ' more useful for dumps '
77 return '<%s to "%s">'%(self.__class__, self.classname) 87 return '<%s to "%s">'%(self.__class__, self.classname)
78 88
79 class DatabaseError(ValueError): 89 class DatabaseError(ValueError):
90 '''Error to be raised when there is some problem in the database code
91 '''
80 pass 92 pass
81 93
82 94
83 # 95 #
84 # the base Database class 96 # the base Database class
254 266
255 # do the db-related init stuff 267 # do the db-related init stuff
256 db.addclass(self) 268 db.addclass(self)
257 269
258 def __repr__(self): 270 def __repr__(self):
271 '''Slightly more useful representation
272 '''
259 return '<hypderdb.Class "%s">'%self.classname 273 return '<hypderdb.Class "%s">'%self.classname
260 274
261 # Editing nodes: 275 # Editing nodes:
262 276
263 def create(self, **propvalues): 277 def create(self, **propvalues):
1022 """ 1036 """
1023 for key in properties.keys(): 1037 for key in properties.keys():
1024 if self.properties.has_key(key): 1038 if self.properties.has_key(key):
1025 raise ValueError, key 1039 raise ValueError, key
1026 self.properties.update(properties) 1040 self.properties.update(properties)
1027
1028 1041
1029 # XXX not in spec 1042 # XXX not in spec
1030 class Node: 1043 class Node:
1031 ''' A convenience wrapper for the given node 1044 ''' A convenience wrapper for the given node
1032 ''' 1045 '''
1082 cl.create(name=options[i], order=i) 1095 cl.create(name=options[i], order=i)
1083 return hyperdb.Link(name) 1096 return hyperdb.Link(name)
1084 1097
1085 # 1098 #
1086 # $Log: not supported by cvs2svn $ 1099 # $Log: not supported by cvs2svn $
1100 # Revision 1.58 2002/02/27 03:23:16 richard
1101 # Ran it through pychecker, made fixes
1102 #
1087 # Revision 1.57 2002/02/20 05:23:24 richard 1103 # Revision 1.57 2002/02/20 05:23:24 richard
1088 # Didn't accomodate new values for new properties 1104 # Didn't accomodate new values for new properties
1089 # 1105 #
1090 # Revision 1.56 2002/02/20 05:05:28 richard 1106 # Revision 1.56 2002/02/20 05:05:28 richard
1091 # . Added simple editing for classes that don't define a templated interface. 1107 # . Added simple editing for classes that don't define a templated interface.

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