[Tutor] Questions about shelve

Jackson david.jay.jackson@wcox.com
Tue, 23 Oct 2001 13:18:05 -0600


Objective (Please see script below):
Create simple server outage tracking db. While MySQL
would be easer to use, it's not as much fun *grin*

Data layout:
Each record consist of; hostname,date,problem,resolution with
hostname and date beging key fields, and problem/resolution being multi-line text field.

What's missing:
1. Need to be able to enter more than one outage per server, did I read someplace that you can set Btree to allow dup keys?

2. Change "end_of_field" char to Ctrl+a to allow multi line imput for problem and resolution fields.

Thanks for you time.
David Jackson


-------------      Script -----------------------

#!/usr/bin/python
import shelve
#
people = shelve.open("/tmp/btree.db")
host=raw_input("Enter Hostname: ")  	
date=raw_input("Date of Outage: ")				problem=raw_input("Problem Descrption: ")
resolution=raw_input("Problem Resolution: ")
people[host]=[date,problem,resolution]
people.close()