Mercurial > p > roundup > code
comparison roundup/hyperdb.py @ 2737:37e2b70105f7
removed safeget() from the API [SF#994750]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Fri, 08 Oct 2004 05:44:33 +0000 |
| parents | 7c472ed6babf |
| children | a8808157f892 |
comparison
equal
deleted
inserted
replaced
| 2736:402d6d556558 | 2737:37e2b70105f7 |
|---|---|
| 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.103 2004-10-08 00:56:11 richard Exp $ | 18 # $Id: hyperdb.py,v 1.104 2004-10-08 05:44:33 richard Exp $ |
| 19 | 19 |
| 20 """Hyperdatabase implementation, especially field types. | 20 """Hyperdatabase implementation, especially field types. |
| 21 """ | 21 """ |
| 22 __docformat__ = 'restructuredtext' | 22 __docformat__ = 'restructuredtext' |
| 23 | 23 |
| 551 | 551 |
| 552 def index(self, nodeid): | 552 def index(self, nodeid): |
| 553 '''Add (or refresh) the node to search indexes | 553 '''Add (or refresh) the node to search indexes |
| 554 ''' | 554 ''' |
| 555 raise NotImplementedError | 555 raise NotImplementedError |
| 556 | |
| 557 def safeget(self, nodeid, propname, default=None): | |
| 558 """Safely get the value of a property on an existing node of this class. | |
| 559 | |
| 560 Return 'default' if the node doesn't exist. | |
| 561 """ | |
| 562 try: | |
| 563 return self.get(nodeid, propname) | |
| 564 except IndexError: | |
| 565 return default | |
| 566 | 556 |
| 567 def export_propnames(self): | 557 def export_propnames(self): |
| 568 '''List the property names for export from this Class.''' | 558 '''List the property names for export from this Class.''' |
| 569 propnames = self.getprops().keys() | 559 propnames = self.getprops().keys() |
| 570 propnames.sort() | 560 propnames.sort() |
