Mercurial > p > roundup > code
comparison roundup/backends/rdbms_common.py @ 2966:2ddba486546a
various fixes
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 25 Nov 2004 23:53:31 +0000 |
| parents | 2eae5848912d |
| children | 693069ac2039 |
comparison
equal
deleted
inserted
replaced
| 2964:b71f6d0a463d | 2966:2ddba486546a |
|---|---|
| 1 # $Id: rdbms_common.py,v 1.140 2004-11-10 22:22:58 richard Exp $ | 1 # $Id: rdbms_common.py,v 1.141 2004-11-25 23:53:31 richard Exp $ |
| 2 ''' Relational database (SQL) backend common code. | 2 ''' Relational database (SQL) backend common code. |
| 3 | 3 |
| 4 Basics: | 4 Basics: |
| 5 | 5 |
| 6 - map roundup classes to relational tables | 6 - map roundup classes to relational tables |
| 2604 | 2604 |
| 2605 # do content? | 2605 # do content? |
| 2606 if content: | 2606 if content: |
| 2607 # store and index | 2607 # store and index |
| 2608 self.db.storefile(self.classname, itemid, None, content) | 2608 self.db.storefile(self.classname, itemid, None, content) |
| 2609 mime_type = None | |
| 2609 if self.getprops().has_key('type'): | 2610 if self.getprops().has_key('type'): |
| 2610 mime_type = propvalues.get('type', self.get(itemid, 'type', | 2611 mime_type = propvalues.get('type', self.get(itemid, 'type')) |
| 2611 self.default_mime_type)) | 2612 if not mime_type: |
| 2612 else: | |
| 2613 mime_type = self.default_mime_type | 2613 mime_type = self.default_mime_type |
| 2614 self.db.indexer.add_text((self.classname, itemid, 'content'), | 2614 self.db.indexer.add_text((self.classname, itemid, 'content'), |
| 2615 content, mime_type) | 2615 content, mime_type) |
| 2616 | 2616 |
| 2617 propvalues['content'] = content | 2617 propvalues['content'] = content |
| 2624 '''Add (or refresh) the node to search indexes. | 2624 '''Add (or refresh) the node to search indexes. |
| 2625 | 2625 |
| 2626 Pass on the content-type property for the content property. | 2626 Pass on the content-type property for the content property. |
| 2627 ''' | 2627 ''' |
| 2628 Class.index(self, nodeid) | 2628 Class.index(self, nodeid) |
| 2629 try: | 2629 mime_type = None |
| 2630 mime_type = self.get(nodeid, 'type', self.default_mime_type) | 2630 if self.getprops().has_key('type'): |
| 2631 except KeyError: | 2631 mime_type = self.get(nodeid, 'type') |
| 2632 if not mime_type: | |
| 2632 mime_type = self.default_mime_type | 2633 mime_type = self.default_mime_type |
| 2633 self.db.indexer.add_text((self.classname, nodeid, 'content'), | 2634 self.db.indexer.add_text((self.classname, nodeid, 'content'), |
| 2634 str(self.get(nodeid, 'content')), mime_type) | 2635 str(self.get(nodeid, 'content')), mime_type) |
| 2635 | 2636 |
| 2636 # XXX deviation from spec - was called ItemClass | 2637 # XXX deviation from spec - was called ItemClass |
