@@ -261,9 +261,7 @@ def addclass(self, cl):
261261
262262 def getclasses (self ):
263263 """Return a list of the names of all existing classes."""
264- l = self .classes .keys ()
265- l .sort ()
266- return l
264+ return sorted (self .classes .keys ())
267265
268266 def getclass (self , classname ):
269267 """Get the Class object representing a particular class.
@@ -484,7 +482,7 @@ def serialise(self, classname, node):
484482 """
485483 properties = self .getclass (classname ).getprops ()
486484 d = {}
487- for k , v in node .iteritems ():
485+ for k , v in node .items ():
488486 if k == self .RETIRED_FLAG :
489487 d [k ] = v
490488 continue
@@ -511,7 +509,7 @@ def unserialise(self, classname, node):
511509 """
512510 properties = self .getclass (classname ).getprops ()
513511 d = {}
514- for k , v in node .iteritems ():
512+ for k , v in node .items ():
515513 # if the property doesn't exist, or is the "retired" flag then
516514 # it won't be in the properties dict
517515 if k not in properties :
@@ -600,7 +598,7 @@ def setjournal(self, classname, nodeid, journal):
600598 def fix_journal (self , classname , journal ):
601599 """ fix password entries to correct type """
602600 pwprops = {}
603- for pn , prop in self .getclass (classname ).properties .iteritems ():
601+ for pn , prop in self .getclass (classname ).properties .items ():
604602 if isinstance (prop , hyperdb .Password ):
605603 pwprops [pn ] = 1
606604 if not pwprops :
@@ -724,7 +722,7 @@ def commit(self):
724722 reindex [method (* args )] = 1
725723 finally :
726724 # make sure we close all the database files
727- for db in self .databases .itervalues ():
725+ for db in self .databases .values ():
728726 db .close ()
729727 del self .databases
730728
@@ -916,7 +914,7 @@ def create_inner(self, **propvalues):
916914
917915 # validate propvalues
918916 num_re = re .compile ('^\d+$' )
919- for key , value in propvalues .iteritems ():
917+ for key , value in propvalues .items ():
920918 if key == self .key :
921919 try :
922920 self .lookup (value )
@@ -1027,7 +1025,7 @@ def create_inner(self, **propvalues):
10271025 raise TypeError ('new property "%s" not boolean' % key )
10281026
10291027 # make sure there's data where there needs to be
1030- for key , prop in self .properties .iteritems ():
1028+ for key , prop in self .properties .items ():
10311029 if key in propvalues :
10321030 continue
10331031 if key == self .key :
@@ -1168,7 +1166,7 @@ class or a KeyError is raised.
11681166
11691167 self .fireAuditors ('set' , nodeid , propvalues )
11701168 oldvalues = copy .deepcopy (self .db .getnode (self .classname , nodeid ))
1171- for name , prop in self .getprops (protected = 0 ).iteritems ():
1169+ for name , prop in self .getprops (protected = 0 ).items ():
11721170 if name in oldvalues :
11731171 continue
11741172 if isinstance (prop , hyperdb .Multilink ):
@@ -1551,7 +1549,7 @@ def find(self, **propspec):
15511549 db.issue.find(messages='1')
15521550 db.issue.find(messages={'1':1,'3':1}, files={'7':1})
15531551 """
1554- for propname , itemids in propspec .iteritems ():
1552+ for propname , itemids in propspec .items ():
15551553 # check the prop is OK
15561554 prop = self .properties [propname ]
15571555 if not isinstance (prop , hyperdb .Link ) and not isinstance (prop , hyperdb .Multilink ):
@@ -1566,7 +1564,7 @@ def find(self, **propspec):
15661564 item = self .db .getnode (self .classname , id , db = cldb )
15671565 if self .db .RETIRED_FLAG in item :
15681566 continue
1569- for propname , itemids in propspec .iteritems ():
1567+ for propname , itemids in propspec .items ():
15701568 if type (itemids ) is not type ({}):
15711569 itemids = {itemids :1 }
15721570
@@ -1616,7 +1614,7 @@ def stringFind(self, **requirements):
16161614 node = self .db .getnode (self .classname , nodeid , cldb )
16171615 if self .db .RETIRED_FLAG in node :
16181616 continue
1619- for key , value in requirements .iteritems ():
1617+ for key , value in requirements .items ():
16201618 if key not in node :
16211619 break
16221620 if node [key ] is None or node [key ].lower () != value :
@@ -1720,7 +1718,7 @@ def _filter(self, search_matches, filterspec, proptree,
17201718 INTERVAL = 'spec:interval'
17211719 OTHER = 'spec:other'
17221720
1723- for k , v in filterspec .iteritems ():
1721+ for k , v in filterspec .items ():
17241722 propclass = props [k ]
17251723 if isinstance (propclass , hyperdb .Link ):
17261724 if type (v ) is not type ([]):
@@ -2001,7 +1999,7 @@ def addprop(self, **properties):
20011999 def index (self , nodeid ):
20022000 """ Add (or refresh) the node to search indexes """
20032001 # find all the String properties that have indexme
2004- for prop , propclass in self .getprops ().iteritems ():
2002+ for prop , propclass in self .getprops ().items ():
20052003 if isinstance (propclass , hyperdb .String ) and propclass .indexme :
20062004 # index them under (classname, nodeid, property)
20072005 try :
@@ -2107,7 +2105,7 @@ def export_journals(self):
21072105 date = date .get_tuple ()
21082106 if action == 'set' :
21092107 export_data = {}
2110- for propname , value in params .iteritems ():
2108+ for propname , value in params .items ():
21112109 if propname not in properties :
21122110 # property no longer in the schema
21132111 continue
@@ -2201,7 +2199,7 @@ def set(self, itemid, **propvalues):
22012199
22022200 # create the oldvalues dict - fill in any missing values
22032201 oldvalues = copy .deepcopy (self .db .getnode (self .classname , itemid ))
2204- for name , prop in self .getprops (protected = 0 ).iteritems ():
2202+ for name , prop in self .getprops (protected = 0 ).items ():
22052203 if name in oldvalues :
22062204 continue
22072205 if isinstance (prop , hyperdb .Multilink ):
@@ -2238,7 +2236,7 @@ def index(self, nodeid):
22382236 Use the content-type property for the content property.
22392237 """
22402238 # find all the String properties that have indexme
2241- for prop , propclass in self .getprops ().iteritems ():
2239+ for prop , propclass in self .getprops ().items ():
22422240 if prop == 'content' and propclass .indexme :
22432241 mime_type = self .get (nodeid , 'type' , self .default_mime_type )
22442242 self .db .indexer .add_text ((self .classname , nodeid , 'content' ),
0 commit comments