I am writing a web application for mod_python that catalogs my home
(book) library. For now, I am using the Python dbm module to store
string representations of mod_python's req.form (using the
mod_python.publ isher handler) using unique IDs as keys. In the .db
file, there is a key 'next' that holds the next key for the next form
submission. A TypeError exception is raised though when I attempt to
increment the 'next' key. This only occurs in mod_python.
This code...
self._db['next'] = str(int(self._d b['next'])+1)
raises this exception....
TypeError: string indices must be integers
[color=blue][color=green][color=darkred]
>>> y = dbm.open("Test" ,"c")
>>> next = 0
>>> y['next'] = str(next)
>>> y['next'] = str(int(y['next'])+1)
>>> y['next'][/color][/color][/color]
'1'[color=blue][color=green][color=darkred]
>>> y['next'] = str(int(y['next'])+1)
>>> y['next'][/color][/color][/color]
'2'
I do not understand the cause of this exception. I am using Python
2.3.5. Any help would be greatly appreciated.
Ryan Kaskel
(book) library. For now, I am using the Python dbm module to store
string representations of mod_python's req.form (using the
mod_python.publ isher handler) using unique IDs as keys. In the .db
file, there is a key 'next' that holds the next key for the next form
submission. A TypeError exception is raised though when I attempt to
increment the 'next' key. This only occurs in mod_python.
This code...
self._db['next'] = str(int(self._d b['next'])+1)
raises this exception....
TypeError: string indices must be integers
[color=blue][color=green][color=darkred]
>>> y = dbm.open("Test" ,"c")
>>> next = 0
>>> y['next'] = str(next)
>>> y['next'] = str(int(y['next'])+1)
>>> y['next'][/color][/color][/color]
'1'[color=blue][color=green][color=darkred]
>>> y['next'] = str(int(y['next'])+1)
>>> y['next'][/color][/color][/color]
'2'
I do not understand the cause of this exception. I am using Python
2.3.5. Any help would be greatly appreciated.
Ryan Kaskel